in reply to Re^2: No Substitution Happening
in thread No Substitution Happening
please see the below code,
#sub change_ext_if_file { #foreach my $file ($_) { # if (($file eq -f) && ($file =~ /.pdf$/)) { # $file =~ s/.pdf/.doc/; #Above, better written as below, perhaps? sub change_ext_if_file { my @files = $_; foreach my $file if ((@files eq -f) && (@files =~ /\.pdf$/)) { $file =~ s/pdf/doc/; } }
I'm guessing, going by some code suggestions above, that there is a quicker, cleaner way of achieving the end result, but, I'm just playing, to learn what things do, so I'm not looking, I guess, for shorter ways just yet. Hope that makes sense, and doesn't seem ungrateful? Cheers
coolboarderguy...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: No Substitution Happening
by coolboarderguy (Acolyte) on Mar 24, 2006 at 09:22 UTC | |
by fishbot_v2 (Chaplain) on Mar 24, 2006 at 16:54 UTC |