in reply to Perl Syntax/resources that we generally don't know or forget.
$#array = -1I prefer @array = () for far less magic understanding needed.
if ( $_ =~ /\Q$find\E/s ) { ... }You can leave off the \E. And that $_ =~ would have me puzzled for a minute or two, being very non-idiomatic. Worth leaving off.
my ($final) = ( $data =~ /\G(.*)$/s ) ;You should add /c and test the match, otherwise you'll mess up the outer loop if the match fails.
substr($str , 0 , 0) = ">>"I prefer either $str = "$str>>" or $str =~ s/^/>>/ for that. substr gives me gas, sometimes.
my @lyb = (a..z , A..Z , 0..9) ;That breaks under use strict, and if the begin or end point is one of the magic single-character syntax things like "q" or "s" or "y". Best to quote the begin/end points.
-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: •Re: Perl Syntax that we generally don't know.
by jdhedden (Deacon) on Mar 26, 2004 at 17:20 UTC | |
by merlyn (Sage) on Mar 26, 2004 at 18:17 UTC |