Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Stuff and Things

by premchai21 (Curate)
on Feb 26, 2001 at 09:35 UTC ( [id://60822]=poem: print w/replies, xml ) Need Help??

My first attempt at writing a poem in Perl... here goes. Compiles and runs.
#!/usr/bin/perl # Ambiguity! local *said=*liminal,*where=*liminal; <DATA>; is(),?it so?; "it is",said("he"); "and so it is",said("she"); ?which?; /not here/./not there/./not anywhere/; not where(); ?which?; /not this/./not that/./not any/; "and so it isn't",said("he"); "and so it",not is(),said("she"); sub liminal() { my ($message,@TO,$u); @TO=qw(erty); is(); @TO=("run this"); } sub is() { } __DATA__ Have mercy on me...

Replies are listed 'Best First'.
Re: Stuff and Things
by japhy (Canon) on Feb 26, 2001 at 20:38 UTC
    "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

      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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: poem [id://60822]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2024-03-29 14:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found