use File::Basename;


-Thomas Kinzer

----Original Message Follows---- From: Rod Za <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: ways to change the first char from a filename (with full path) Date: Tue, 29 Jun 2004 09:03:42 -0700 (PDT) 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>

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar – get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/



-- 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