in reply to Re^2: This regular expression has me stumped
in thread This regular expression has me stumped
You almost never want .* A negated character class is generally better. For example m!/[(^/)]+$! will grab the last bit of the filepath reliably but the regex posted above in the map should DWIM
You could certainly code the example above as a one liner but it seems a waste of time to me. You can make a reusable 4 line script in less time than it will take fiddling. You can put options like -p -F -n on the shebang. As a one liner it would be like:
perl -F -ane 'print map{"$_\n"} map{ } grep { } @F' <file>
where the map and grep blocks are as above.
|
|---|