Hello Monks, I have a file name and path which i am trying to parse. The $file contains the full path of the file.So i split based on \. Taking the second argument(file resides in a folder under root), i want to strip the extension. This is what I am doin.
foreach my $file (@files){ my @arr=split(/\//,$file); print "\n $arr[2];"; }
Now this is what I am trying to do to remove the extension for the file. "system%abc%123%.txt" which is the valule in $arr2.
my $length_arr=length($arr[2]); my $fname=sub($arr[2],0,($length_arr-4)); print $fname;
It gives me a weird error."Perl Command Line Interpreter has encountered a problem and needs to close.We are sorry for the inconvinience.
The error signature looks like this. AppName:perl.exe AppVer:5.6.1.635 ModName:perl56.dll ModVer: 5.6.1.635 Offset: 0001c6d9 Can anyone help me figure what could be wrong? Thanks Sandy (smanicka) Sorry, I feel soo stupid.Its substr as pointed out by ysth.Thanks
In reply to weird error when using substring function by smanicka
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |