#!/usr/bin/perl #my hash which tries to "map" a regular expression to a a new name my %Ren2Dol = ( rrv193\d{4}cm => "RNF191", ); #pretend data line to teest my $line='rrv1931009cm.new090626'; #split the data line ($base,$rest)=split(/[\.\_]/,$line,2); #test print it to see that it split correxctly print "$base\n"; #try to see what new name would be my $newname=$Ren2Dol{$base}; print "$newname\n"; # a test print to make sure regular expression matches if ($line=~m/^rrv193\d{4}cm/) {print "line matched\n"}; if ($base=~m/^rrv193\d{4}cm/) {print "base matched\n"};