ArifS has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to get the following-while (my $file = <DATA>) { $file =~ /(\d+)(lc|pp)/i or next; my $posA = uc "$1$2-"; # $file =~ /(sh|lic)/i or next; # my $posB = uc $1; $file =~ /(800|2621|3524|6509|7206)(s-|r-)/i or next; my $dv = uc "$1$2"; $file =~ /([a-z]+)(\d+)/i or next; my $loc = uc "$1$2"; print "$posA" or die; # print "$posB" or die; print "$dv" or die; print "$loc" or die; print "\n"; } __DATA__ 1lc-2621s-RT02-9FL 2pp-3524-7FL PP_800c_-RT1-TX 10lc-7206-3FL-SW02 LC-6509r-SW1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex renaming
by GotToBTru (Prior) on Oct 09, 2014 at 19:51 UTC | |
by ArifS (Beadle) on Oct 10, 2014 at 13:40 UTC | |
|
Re: Regex renaming
by AnomalousMonk (Archbishop) on Oct 09, 2014 at 20:34 UTC | |
by ArifS (Beadle) on Oct 10, 2014 at 13:41 UTC | |
|
Re: Regex renaming
by Athanasius (Archbishop) on Oct 11, 2014 at 07:30 UTC | |
by ArifS (Beadle) on Oct 14, 2014 at 12:46 UTC |