fergal has asked for the wisdom of the Perl Monks concerning the following question:
for (1..10) { $first ||= $last = $_; } print "$first..$last\n";
I was doing something like this in a one liner (to extract the first and last lines of a file). It made me scratch my head.
Is this a feature? (this is the meditation part of the posting :).
Update: I know why it does it, I'm just curious to see if anyone else is surprised by it or gets it wrong first time.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: what does this print?
by cog (Parson) on Apr 28, 2005 at 16:35 UTC | |
|
Re: what does this print?
by eric256 (Parson) on Apr 28, 2005 at 16:54 UTC | |
|
Re: what does this print?
by salva (Canon) on Apr 28, 2005 at 16:31 UTC |