Re: perl equivelent of which in bash

2012-01-04 Thread John W. Krahn

Jim Green wrote:

Greetings!


Hello,


basically I need a perl equivalent in bash that does which and gives
me the binary path. I need this because I run my script in different
systems I want the binary automatically adjusted.



use Env q/@PATH/;

my $file = shift or exit 1;

my @which_files = grep -x, map "$_/$file", @PATH;




John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction.   -- Albert Einstein

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: perl equivelent of which in bash

2012-01-04 Thread Jim Green
Thank you! I should have searched cpan.

Jim.


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: perl equivelent of which in bash

2012-01-04 Thread Shawn H Corey

On 12-01-04 04:37 PM, Jim Green wrote:

Greetings!
basically I need a perl equivalent in bash that does which and gives me the 
binary path. I need this because I run my script in different systems I want 
the binary automatically adjusted.

Thanks!
Jim.




Perhaps FindBin is the module you want. It finds the "binary" of the 
Perl script. See `perldoc FindBin` for details.


FindBin is a standard module and is installed when the rest of Perl is. 
For a list of standard pragmatics and modules, see `perldoc perlmodlib`.



--
Just my 0.0002 million dollars worth,
  Shawn

Programming is as much about organization and communication
as it is about coding.

Never give up your dreams.  Give up your goals, plans,
strategy, tactics, and anything that's not working but never
give up your dreams.

http://www.youtube.com/watch?v=cM5A1K6TxxM
"Never, never, never give up."
  Winston Churchill

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: perl equivelent of which in bash

2012-01-04 Thread Robert Wohlfarth
On Wed, Jan 4, 2012 at 3:37 PM, Jim Green wrote:

> basically I need a perl equivalent in bash that does which and gives me
> the binary path. I need this because I run my script in different systems I
> want the binary automatically adjusted.
>

A quick search of CPAN for the word "which" turned up
File::Which.
It may meet your needs.

-- 
Robert Wohlfarth


Re: perl equivelent of which in bash

2012-01-04 Thread John SJ Anderson
On Wednesday, January 4, 2012 at 16:37 , Jim Green wrote:
> Greetings!
> basically I need a perl equivalent in bash that does which and gives me the 
> binary path. I need this because I run my script in different systems I want 
> the binary automatically adjusted.
> 

Does  look like it would fit the bill?

chrs,
john.

 
> 
> 
> 




perl equivelent of which in bash

2012-01-04 Thread Jim Green
Greetings!
basically I need a perl equivalent in bash that does which and gives me the 
binary path. I need this because I run my script in different systems I want 
the binary automatically adjusted.

Thanks!
Jim.


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/