in reply to Re: How to process .csv file
in thread How to process .csv file
A variation using substitution can do some input validation as well (tested):
(The messy stuff in the @{[ ... ]} should probably be factored out to a subroutine.)s{ \A (\S+) \s+ (\S+) \z }{@{[ $2 eq 'WR' ? 'wire' : 'reg' ]} $1}xms or die "bad input: '$_'" for @lines;
Give a man a fish: <%-{-{-{-<
|
|---|