|
|
| Perl Monk, Perl Meditation | |
| PerlMonks |
Re: finding the field number of a matching pattern in perlby roboticus (Canon) |
| on Sep 16, 2012 at 14:16 UTC ( #993915=note: print w/ replies, xml ) | Need Help?? |
|
You've got plenty of answers already, so I'll just play around a little:
The hash maps the fields with the field index. Wrapping the right hand side of the hash assignment in a do statement lets me localize a temporary variable. Preincrementing the temp variable converts the field numbers to one-based numbering. ...roboticus When your only tool is a hammer, all problems look like your thumb.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||