In article <[EMAIL PROTECTED]>, Brian Gerard wrote: [...] > I ran into exactly this issue, but I wanted to just get the actual script > name. $0 returns the entire path the script was invoked as. ie - $0 > could be "../../foo/bar/blarch/scriptname.pl", but I just wanted > "scriptname.pl". > > Here's a line that will give you exactly that. > ($PROGNAME = $0) =~ s|(\.?\.?(/[^/]+)*/)?([^/]+)|$3|;
I have two questions... I came up with this earlier today: my ($program) = $0 =~ /([^\/]+)$/; Doesn't it do the same? (Question 1) If I don't escape the slash in the char class -- i.e. /([^\/]+)$/ -- I get this error: Unmatched [ in regex; marked by <-- HERE in m/([ <-- HERE ^/ at ./test-0 line 7. This makes no sense to me (since this is Perl and not sed or something)... (implied Question 2) -Kevin -- Kevin Pfeiffer -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]