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: <%-{-{-{-<
In reply to Re^2: How to process .csv file
by AnomalousMonk
in thread How to process .csv file
by Sivalakshmi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |