[EMAIL PROTECTED] wrote: > Hi > > I have a problem > > I have > $FILENAME=C:\Developer\view_local\local_nt\FDAFDSAFDSASDFA\ASDFDAFSASDF\NewP rocess_date_22-oct-2004.log > > How to get 'NewProcess only word
Use the basename() function from the File::Basename module to separate the file name from the rest of the path. use File::Basename; my $name = basename($FILENAME, '.log'); If you want the first 7 chars, use substr(): print substr($name, 0, 7); If you want the part up to the underscore, you can use a regex to delete the stuff after the underscore: $name =~ s/_.*//s; print $name; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>