The original trick is multiplying the first regex result (as a scalar) by the second regex result (as a scalar). That is, 1*1 is true, but 0*1 is false.my $number = '..2314-1234123.'; if ($number =~ /\d/ * /^([\d.-]+)$/) { print "$1\n"; }
However, since the two regexen aren't being bound to $number in your example, the code actually doesn't work. The second regex is searching $_ for matches instead.
--
[ e d @ h a l l e y . c c ]
In reply to Re: Re: Re: Golf this reg ex
by halley
in thread Golf this reg ex
by bradcathey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |