what Shawn just wrote could be ok for you Brian, but only if you change
working directory while processing files, because his script uses cwd() to
get directory (which reads 'current working directory')

the other option would be to say:

use File::Basename;
use File::Spec;

my @alldirs = File::Spec->splitdir( File::Spec->rel2abs( dirname($file) ) );
my $dir = $alldirs[-1];


2008/9/3 Mr. Shawn H. Corey <[EMAIL PROTECTED]>

> On Wed, 2008-09-03 at 16:47 +0100, brian54321uk wrote:
> > Just tested this out and unfortunately instead of dirname replacing
> > abc123, I get a .
>
> That's because the dirname is a '.'
>
> Try:
>
> use Cwd;
> if( (my $dir = dirname( $file )) eq '.' ){
>  $dir = cwd();
> }
>
>
> --
> Just my 0.00000002 million dollars worth,
>  Shawn
>
> "Where there's duct tape, there's hope."
>        Cross Time Cafe
>
> "Perl is the duct tape of the Internet."
>        Hassan Schroeder, Sun's first webmaster
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> http://learn.perl.org/
>
>
>

Reply via email to