Hi all,
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?:
_BEGIN_
#!/usr/bin/perl -w
my($file) = $ARGV[0]; #receives the filename
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
print "Original Filename: $file - Changed Filename: $IPPFile\n"; #print the result
_END_
e.g. ./filename.pl /var/spool/cups/d00001
will print:
Original Filename: /var/spool/cups/d00001 - Changed Filename: /var/spool/cups/c00001
Thank you.
Rod
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>