Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Attempting to be more perl-ish

17 views
Skip to first unread message

Matt Sheppard

unread,
Nov 9, 2012, 9:33:23 AM11/9/12
to begi...@perl.org
Looking for advice on how to be more "perlish" in this bit of code. The idea is to allow execution of a script without pathing in the $0 parameter:

if ($0 =~ m/^\//) {
exec("$0 @ARGV");
} else {
exec("./$0 @ARGV");
}

Thanks,
M@

John SJ Anderson

unread,
Nov 9, 2012, 9:37:17 AM11/9/12
to begi...@perl.org

On Nov 9, 2012, at 6:33 AM, Matt Sheppard <mshe...@dyn.com> wrote:

> Looking for advice on how to be more "perlish" in this bit of code. The idea is to allow execution of a script without pathing in the $0 parameter:


This really feels like one of those "instead of asking how to do something, explain what you're trying to achieve" type deals. What are you actually trying to do here?

j.

--
John SJ Anderson // gene...@genehack.org


Shawn H Corey

unread,
Nov 9, 2012, 9:41:56 AM11/9/12
to begi...@perl.org
exec( $0, @ARGV );
die "could not create infinite loop\n";


--
Just my 0.00000002 million dollars worth,
Shawn

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

Why fit in when you can stand out?
Dr. Seuss

The only way that problems get solved in real life is with a lot of
hard work on getting the details right.
Linus Torvalds
0 new messages