Re: Is Perl *that* good?
imbosol@aerojoc key.com (Carl Banks) wrote in message news:<60dfb6f6. 0404281459.2167 5af4@posting.go ogle.com>...[color=blue]
> In file x.pl:
>
> sub muck() {
> $_ = "sucker\n";
> }
>
> while(<>) {
> if (/^abc/) {
> muck();
> print $_;
> }
> }
>
> Command line:
>
> echo abcdefg | perl x.pl
>
> Output:
>
> sucker
>
>
> I had actually thought it restored $_.
> It never ceases to amaze me how bad Perl is.[/color]
Wait a minute, Perl does restore the regexp implicits.
In file x.pl:
sub muck() {
$_ = sucker;
/sucker/;
}
while(<>) {
if (/^abc/) {
muck();
print $&;
print "\n";
}
}
Command line:
echo abcdefg | perl x.pl
Output:
abc
Perl has failed to amaze me at just how bad
it is this one time. :)
--
CARL BANKS
imbosol@aerojoc key.com (Carl Banks) wrote in message news:<60dfb6f6. 0404281459.2167 5af4@posting.go ogle.com>...[color=blue]
> In file x.pl:
>
> sub muck() {
> $_ = "sucker\n";
> }
>
> while(<>) {
> if (/^abc/) {
> muck();
> print $_;
> }
> }
>
> Command line:
>
> echo abcdefg | perl x.pl
>
> Output:
>
> sucker
>
>
> I had actually thought it restored $_.
> It never ceases to amaze me how bad Perl is.[/color]
Wait a minute, Perl does restore the regexp implicits.
In file x.pl:
sub muck() {
$_ = sucker;
/sucker/;
}
while(<>) {
if (/^abc/) {
muck();
print $&;
print "\n";
}
}
Command line:
echo abcdefg | perl x.pl
Output:
abc
Perl has failed to amaze me at just how bad
it is this one time. :)
--
CARL BANKS
Comment