in reply to shift or die unless

Yeah, that's fine, but you have to shift @ARGV rather than @_. Also, I think you need to use (time - (stat $arg)[9])>7 rather than -M, but I could be wrong.

-Paul

Replies are listed 'Best First'.
Re^2: shift or die unless
by Bloodnok (Vicar) on Dec 03, 2008 at 12:55 UTC
    If shift is called outside of a sub, then @ARGV is the shifted list or, put another way, shift only acts on @_ if either shift called within a sub or @_ is explicitly supplied as an argument e.g. shift @_ (see shift).

    Update:

    Added extra circumstance under which @_ is acted on

    A user level that continues to overstate my experience :-))
      I did not know that. I'm shocked actually. Here I've been naming @ARGV all this time ... Huh.

      -Paul

Re^2: shift or die unless
by almut (Canon) on Dec 03, 2008 at 13:44 UTC
    I think you need to use (time - (stat $arg)[9])>7 rather than -M

    I think -M is fine here, as it's

    -M  Script start time minus file modification time, in days.

    ...which - as I understand - is what the OP wants.