Hi I'm relatively new to Perl.
I'm attempting to read in all the file names which are located in a directory to an array, modify each file name by removing the last 4 characters of each file then replacing them with a new 4 character extension. I then would like to set symbolic links using the new file names.
eg:- <filename>.im g to <filename>_trn. img
So far i have the following code which works fine at creating the symbolic links, but i cant seem to get the file name change.
Please help :)
[code=perl]
my $dirs = "$folder";
opendir (BIN, $dirs) || die "cant open directory: $!";
my @array = grep { -d "$dirs" } readdir BIN;
foreach my $file (@array) {eval {
symlink ("$folder/$file","$file/_trn.img");
[/code]
I'm attempting to read in all the file names which are located in a directory to an array, modify each file name by removing the last 4 characters of each file then replacing them with a new 4 character extension. I then would like to set symbolic links using the new file names.
eg:- <filename>.im g to <filename>_trn. img
So far i have the following code which works fine at creating the symbolic links, but i cant seem to get the file name change.
Please help :)
[code=perl]
my $dirs = "$folder";
opendir (BIN, $dirs) || die "cant open directory: $!";
my @array = grep { -d "$dirs" } readdir BIN;
foreach my $file (@array) {eval {
symlink ("$folder/$file","$file/_trn.img");
[/code]
Comment