Re: [SLUG] perl equivalent for cd $(dirname $0)?
Sonia Hamilton wrote: The difficulty in solving problems in any new topic is often knowing what question to ask :-) I searched and searched (got the perl doco locally), but didn't know what to look for... Even if you know what you are looking for, things can be difficult. Ever try to find out how the 'read' command works in bash? Searching for the word 'read' in the doco leaves me breathless. cheers rickw -- Rick Welykochy || Praxis Services || Internet Driving Instructor We like to think of ourselves as the Microsoft of the energy world. -- Kenneth Lay, former CEO of Enron -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] perl equivalent for cd $(dirname $0)?
On Thu, 2008-04-24 at 22:05 +1000, Amos Shapira wrote: On Wed, Apr 23, 2008 at 5:37 PM, Sonia Hamilton [EMAIL PROTECTED] 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? 1. Short answer: http://perldoc.perl.org/File/Basename.html, and $0 in perl works like in the shell. Thanks everyone for all your replies about this. 2. Longer answer: install the FF search engines for perldoc.perl.org and CPAN and you'll always be a simple search away from answers to all perl-related questions you'll ever have. The difficulty in solving problems in any new topic is often knowing what question to ask :-) I searched and searched (got the perl doco locally), but didn't know what to look for... -- Thanks, . Sonia Hamilton http://soniahamilton.wordpress.com http://www.linkedin.com/in/soniahamilton . Your manuscript is both good and original; but the part that is good is not original and the part that is original is not good - Samuel Johnson. -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] perl equivalent for cd $(dirname $0)?
On Wed, Apr 23, 2008 at 5:37 PM, Sonia Hamilton [EMAIL PROTECTED] 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? might not be exactly what you're after... http://perldoc.perl.org/FindBin.html cheers justin -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] perl equivalent for cd $(dirname $0)?
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
Re: [SLUG] perl equivalent for cd $(dirname $0)?
On Wed, Apr 23, 2008 at 5:37 PM, Sonia Hamilton [EMAIL PROTECTED] 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? 1. Short answer: http://perldoc.perl.org/File/Basename.html, and $0 in perl works like in the shell. 2. Longer answer: install the FF search engines for perldoc.perl.org and CPAN and you'll always be a simple search away from answers to all perl-related questions you'll ever have. Cheers, --Amos -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
[SLUG] perl equivalent for cd $(dirname $0)?
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? -- Thanks, . Sonia Hamilton http://soniahamilton.wordpress.com http://www.linkedin.com/in/soniahamilton . I want to share something with you -- the three sentences that will get you through life. Number one, Cover for me. Number two, Oh, good idea, boss. Number three, It was like that when I got here. -- Homer Simpson -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html