This prints "Eitv9/test".use strict; use warnings; #sourcedir, as it comes from <STDIN>, hence it has a newline my $sourcedir = 'C:\Documents and Settings\Administrator\Desktop\eit +v9_lvttest' . "\n"; my $folder_path = 'C:\Documents and Settings\Administrator\Desktop\eit +v9_lvttest'; my $file = "test"; #get rid of newline chomp $sourcedir; #escape backslashes and other possible regex-affecting meta-characters my $sourcedir_regex = quotemeta($sourcedir); if( $folder_path =~ s/$sourcedir_regex/Eitv9/ ) { print "\n$folder_path/$file"; }
In reply to Re: shrinking the path
by holli
in thread shrinking the path
by prad_intel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |