in reply to Re: localtime array slice problem
in thread localtime array slice problem

Good point about trying new things out inside of a script with warnings and use strict on. In this case, since I already knew that localtime is a function, I was able to use the following to get right past both -w and use strict:
#!/usr/bin/perl -w use strict; print @{localtime()}[1,3]; 1;
Running this as
perl -c ltimetest.pl
checks out okay, but running it tells me that I "Can't use string ("Thu Jan 11.... as an ARRAY ref while in strict subs..."

Quick question: Why did -c pass where running the script generates the uncaught exception?-

Celebrate Intellectual Diversity

Replies are listed 'Best First'.
Re: Re: Re: localtime array slice problem
by chipmunk (Parson) on Jan 12, 2001 at 01:48 UTC
    Can't use string %s as %s ref while "strict refs" in use is a runtime error. -c is only for catching compile-time errors.

    There are many, many errors that can occur when a script is running but don't prevent the script from compiling. Here's another example:

    $x = 0; $y = 7 / $x;