in reply to Re: execution log
in thread execution log

Please excuse my ignorance (I'm just getting started with Perl, and I haven't done any programming since I was in school 25 years ago), but do I place that statement in my script? UPDATE: BTW, I'm working in Windows 2000, if that makes a difference.

Replies are listed 'Best First'.
Re^3: execution log
by johngg (Canon) on May 07, 2006 at 12:45 UTC
    Not in the script, no. You use that syntax from the command-line to invoke the script, either in a *nix shell or from a DOS prompt, except under DOS you invoke Perl and give it your script name as the first argument. I normally use Solaris but I managed to turf the kids off the PC to try out what happens under Windows XP. I put this little script together; I called it fred

    use strict; use warnings; print "The beginning\n"; my $flag = 1; warn "Flag set\n" if $flag; die "Farewell, cruel world\n";

    and ran it firstly without any redirection of STDOUT or STDERR like this

    C:> perl fred The beginning Flag set Farewell, cruel world C:>

    I then tried redirecting STDOUT to a file

    C:> perl fred > fred.out Flag set Farewell, cruel world C:> type fred.out The beginning C:>

    Finally, I tried redirecting STDERR as well

    C:> perl fred > fred.out 2>&1 C:> type fred.out The beginning Flag set Farewell, cruel world C:>

    Astonishingly, it seems to work just like Solaris. All they need to do now is get their slashes the right way round and we'll be laughing.

    Cheers,

    JohnGG