NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
return(); (Score:1)
return()with no arguments (which is what you're doing) does the "right thing" in both scalar and list contexts. It returns either an empty list or undefined value.Thus you could also have written:
return;for the same effect. I'm sure you know this already, but from your commentary and style it did look like you were trying to explicitly return an empty list.
Reply to This
Re: (Score:2)
Yes, I normally just use a bare return (and get annoyed when people use 'return 0' for false), but I honestly didn't think about that here because I originally had this:
That showed the annoying __LINE__ problem and I decided to be explicit about the return when I added the $line variable. Normally about the only time -- aside from this example -- I return an explicit empty list is when I do this:
Re: (Score:2)
Oh, and what I didn't say, but should have, in my first reply was "thanks". The bare return is (IMHO) a cleaner solution.
Re: (Score:1)
For less trickery with subs and call stacks and line numbers, remember your old friend 'do'!
$ perl -le'print join " ", (1, do { warn 2; () }, 3)'
2 at -e line 1.
1 3