in reply to problem in outputting files to a new directory
#!/usr/local/bin/perl -w # use strict; # use warnings;
That should be:
#!/usr/local/bin/perl use strict; use warnings;
if($#ARGV != 1)
That is usually written as:
if(@ARGV != 2)
chomp(@ARGV);
There is no need to chomp the @ARGV array!
$dirname =~ s/\/$//g; $output =~ s/\/$//g;
You are anchoring the pattern to the end of the string so the /g option is superfluous.
mkdir $output if (-d $output ==0);
That would usually be written as:
mkdir $output or die "mkdir $output: $!" unless -d $output;
|
|---|