Rod Za wrote:
i'm trying to make a code that get a file name (with full path) and
change the first char of the filename. Someone can say me if
there's a better way to do this?:

Bob gave you a more *portable* solution. A *simpler* (but not portable) way is to skip the split and join operations and replace

my @tmp = split(/\//,$file);    #split the path
$tmp[$#tmp] =~ s/.(\w+)/c$1/g;  #change the first char of the filename
my $IPPFile = join('/',@tmp);   #join again path+'/'+filename

with

    ( my $IPPFile = $file ) =~ s!(.+/).!$1c!;

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to