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):

s{ \A (\S+) \s+ (\S+) \z }{@{[ $2 eq 'WR' ? 'wire' : 'reg' ]} $1}xms or die "bad input: '$_'" for @lines;
(The messy stuff in the  @{[ ... ]} should probably be factored out to a subroutine.)


Give a man a fish:  <%-{-{-{-<