in reply to shift or die unless

Personally, I think you're trying to do too much in that one line. It's not immediately clear when I look at it whether it means
($arg = shift || die "takes one arg") unless -M $file >7;
or
$arg = shift || (die "takes one arg" unless -M $file >7;)
It would, IMO, be much better written as two separate statements.

Replies are listed 'Best First'.
Re^2: shift or die unless
by ikegami (Patriarch) on Dec 03, 2008 at 18:38 UTC
    Only if you think unless is an operator? The second won't even compile.
      It wasn't meant to be runnable code, just to indicate logical grouping.

      More verbosely: It is not immediately obvious whether that line means "check the date of the file and, if it's less than a week old, shift or die" or "if shift returns a false value and the file is less than a week old, then die".

        If it's not runnable code, the logical grouping is impossible.