in reply to Get My Own Name

My suggestion would be to use File::Basename on $0, as it turns out. Example:
use File::Basename; my $scriptname = basename($0);
Simple and to the point. Then just an
unless(basename($file) eq $scriptname) { ... }
in your testing loop, there you go.

Replies are listed 'Best First'.
Re: Re: Get My Own Name
by Anonymous Monk on Feb 05, 2004 at 16:24 UTC

    This assumes you are not going deeper into the tree than the current dir. In that case, you may want to use:

    use File::Basename; my ($scriptname, $scriptdir) = fileparse($0); while($file = shift(@files)){ my($name, $dir) = fileparse($file); unless($dir eq $scriptdir and $scriptname eq $name){ ... } }

    Note: This code is drawn from memory, and not directly tested. I really should take the lead of some of the monks and just put a disclaimer in my sig. OTOH, I did check the perl docs to be sure I hadn't typoed names, and sure enough, I had, so at least it's not typo-rific.