[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Re: HUMOR: you have to see this code!



Matthew Bafford wrote:

> 6) Using regular expressions needlessly:
> 
>         $_ = <INDEXFILE>;
>         if ($_ =~ /(.+)/){$_ = $1;}
>         else {die "Bad data in index $_[0].";}
> 
>    Why not just:
> 
>         chomp($_ = <INDEXFILE>);
>         die "Bad data in index $_[0]." unless length;
> 
>    ?

It doesn't untaint `$_' like the original version does. 
Don't know if it matters in this case, could be just 
a case of copy-n-paste-w/o-thinking from perlsec manpage.
But it definitely isn't exactly the same.

Just to be just.

-- Roland

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe