Hi,
I currently have a regex:
my ($name) = $file =~ m,/path/to/directory/images/(.*),;
which looks for a path and file combination that matches $file - then returns the files name. What I want to do is change it to:
my ($filename) = $file =~ m,$MYCONFIG->{ImagePath}/(.*),;
where $MYCONFIG->{ImagePath} contains the exact path as above but stored in the hash.
The problem I'm having is that when using the hash ref the regex returns the complete path and filename that matches, instead of just the filename which it does when you specify the full path normally.
Can anyone tell me where I'm going wrong?
Cheers,
Regan.
I currently have a regex:
my ($name) = $file =~ m,/path/to/directory/images/(.*),;
which looks for a path and file combination that matches $file - then returns the files name. What I want to do is change it to:
my ($filename) = $file =~ m,$MYCONFIG->{ImagePath}/(.*),;
where $MYCONFIG->{ImagePath} contains the exact path as above but stored in the hash.
The problem I'm having is that when using the hash ref the regex returns the complete path and filename that matches, instead of just the filename which it does when you specify the full path normally.
Can anyone tell me where I'm going wrong?
Cheers,
Regan.