Petras has asked for the wisdom of the Perl Monks concerning the following question:
but this does:my @step=(1..9); push (@step, 0); my $step; foreach (@step) { $step . $_; } print ($step x 7);
yet they look like they should do the same thing. Why don't they?my @step=(1..9); push (@step, 0); my @stepCount=(1..7); foreach (@stepCount) { print @step; }
doesn't do what this does:my $what = "fred|barney"; while (<>) { chomp; if ($_ =~ ($what){3}) { print "It's in there.\n"; } else { print "Not there.\n"; } }
my $what = "(fred|barney){3}"; while (<>) { chomp; if ($_ =~ $what) { print "It's in there.\n"; } else { print "Not there.\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: I'm reading a book! It's given me more questons!
by xdg (Monsignor) on Jul 28, 2005 at 10:49 UTC | |
|
Re: I'm reading a book! It's given me more questons!
by lestrrat (Deacon) on Jul 28, 2005 at 10:31 UTC | |
|
Re: I'm reading a book! It's given me more questons!
by polettix (Vicar) on Jul 28, 2005 at 13:48 UTC | |
|
Re: I'm reading a book! It's given me more questons!
by Codon (Friar) on Jul 28, 2005 at 22:27 UTC |