Just for fun:
while (<FILE>) { print if ( /^(\d+)/ && $1 == 1); }
Oughta do the job too.
(Explanation: if the expression matches, i.e. if there are one or more digits at the beginning of the line, then that sequence of digits will be saved in $1, and then the right-hand-side of the conjunction will be evaluated).
Philosophy can be made out of anything. Or less -- Jerry A. Fodor
In reply to Re: simple regex question
by arturo
in thread simple regex question
by indapa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |