On Wed, Apr 23, 2008 at 05:37:42PM +1000, Sonia Hamilton wrote:
> In my bash scripts I often use this (to change to the directory where
> the script is):
> 
> cd $(dirname $0)
> 
> Is there an equivalent in perl?

  use File::Basename;
  chdir dirname $0;

:-)

Note that perl's $0 is not super-portable (see `perldoc perlvar` for details). 
If you care you want to look at the FindBin module.

Cheers,
Gavin

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to