in reply to Stuff and Things

"Not sure if will compile" can be answered by testing it. If you remove the my declaration, and remove that ! after the # on the first line, it compiles (and runs).

japhy -- Perl and Regex Hacker

Replies are listed 'Best First'.
Re: Re: Stuff and Things
by premchai21 (Curate) on Feb 27, 2001 at 06:52 UTC

    Fixed. Changed my to local. Forgot that my couldn't be used for that... (how absent-minded of me!) As for the ! after the #... it seems to work fine with that left in, as long as you don't try to run it directly (under Unix at least), but rather either run it under Win32 or use the Perl interpreter explicitly (perl poem.pl).

    Drake Wilson

      Nope, having a fake #! line will cause a fatal error, even if you invoke perl explicitly: perl poem.pl because Perl detects the #! line and tries to exec the specified command, just like a shell would do: Can't exec Ambiguity! at poem.pl line 1. This is documented in perlrun:
      If the #! line does not contain the word "perl", the program named after the #! is executed instead of the Perl interpreter. This is slightly bizarre, but it helps people on machines that don't do #!, because they can tell a program that their SHELL is /usr/bin/perl, and Perl will then dispatch the program to the correct interpreter for them.
        Hmm... doesn't seem to work that way for me... must have a non-standard interpreter or something. In any case, thanks, and fixed.