For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > June 2007 > Re: Command line usage









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Command line usage
Fetter

2007-06-19, 6:59 pm

##I have files read into $output_dir

if ($output_dir =~ "_Modified")
{
$allfile2 = $output_dir; #set allfile2 equal to output_dir to keep
output_dir untouched
$_ = $allfile2; #set input string equal to allfile2 for
replacement
s/_Modified//; #replace _Modified with nothing anywhere it
appears in the string
#$_ now equals the filename without the "_Modified"
$allfile2 = $_; #set allfile2 equal to $_
rename ($output_dir, $allfile2); #rename the "_Modified" files
with the new filenames
#warn $allfile2; #shows what allfile2 currently contains
}


Hope this helps!

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com