in reply to Re: Declaring variables - is it legal to do this?
in thread Declaring variables - is it legal to do this?

I'm a Perl newbie, and I'm very surprised by those 3 answers, that say "Try it, and you'll see". You wouldn't say that with some other languages (such as C or C++) because of undefined or unspecified behaviours: it may compile, it may work how you expected (with your compiler), but that's not enough to be sure the behaviour is guarranted. Personnaly, I would have asked such a question, even after trying it, to be sure I'm not wrong.
I understand why people love Perl :)
  • Comment on Re: Re: Declaring variables - is it legal to do this?

Replies are listed 'Best First'.
Re: Re: Re: Declaring variables - is it legal to do this?
by ambrus (Abbot) on May 15, 2004 at 17:39 UTC

    Yes, but there's only one Perl interpreter, so whatever the doncumentation says, the interpreter (perl) is always right. (Larry is always right, in other words.)

    my (undef) surprised me a bit btw.

      Well since perl is written in C, there could be unspecified behaviours in Perl itself (ie. having different valid results for the same code with different platforms), but I guess Perl was designed to avoid that.

        Of course there are. One example is weather select provides the remaining time, and weather it restarts after a signal. This is system-dependent, and ultimately depends on what the kernel and the C library does.