Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

My Life

by tachyon (Chancellor)
on Aug 04, 2001 at 17:53 UTC ( #102233=poem: print w/replies, xml ) Need Help??

my $life; use constant 'Windows'; use less 'Unix'; if( system => booting ) { LILO; select, Windows & wait; } do { something } until system, hangs; eval options; none; reset, system, again; if( system => booting ) { LILO; select, Linux & wait; } do { something } until $finished ++, Linus; while( system => booting ) { LILO; select, Windows & wait; booted & at, last } do { something } until system, hangs, again; eval options, again; reset, system, again; shutdown WIN, again; tell, Bill; hex, Bill; kill, Bill; make, plan; format hardrive = dump Windows; write virus; send message; . die "Go ahead Windows, make my day Invalid page fault in module My Life";




Replies are listed 'Best First'.
Re: My Life
by wine (Scribe) on Aug 04, 2001 at 19:22 UTC
    Wow. Clint vs. Bill.

    After reading this poetic interlude, I felt the strong need to post a probably really stupid technical question. ;)

    I've seen a couple of perl poetries which were formatted like this. I mean, no $'s, extensive use of comma's and lines starting with perl-functions.

    I'm always amazed when these poetries really get compiled by perl. I don't get it, I mean, it doesn't look like valid code. What is it I'm missing?

    Thanks in advance

    - wine

      The , aka the comma operator can be used to separate a list like @list = (1,2,3,4); or you can use it to separate expressions like this:

      $var = "Hello", $var .= " World!" , print $var;

      As you can see the , is acting like a ; Technically what happens is that Perl evaluates the expression on the left hand side and then throws the (return) value away. It then evaluates the expression on the RHS and returns this value. As we care more about the result of evaluating the expression not the return value this is not an issue. See perlman:perlop for more details. The => or "fat comma" operator is just a synonym for ,

      As to the barewords these are an interesting feature. Somtimes known as the poetry optimisation. Run this code and see perlman:lib:strict in the subs section.

      use diagnostics; bareword;

      We use perl functions at the begining of lines all the time - consider print, open, close ..... Just because a function does something and returns a value does not mean you have to use it or even look at it.

      use strict; use warnings; sub myfunc { return "Something" } myfunc; print myfunc;
      You will notice that the calls to the sub myfunc look like barewords but because Perl looks to see if a bareword is a known function this works, and even passes strict and warnings. This would fail if myfunc was not defined before we called it - either in full or as a prototype - because if Perl has not seen a sub definition for myfunc it is a bareword and strict she no like barewords.

      As to why specific things compile you can learn a lot if you add use strict; use warnings; and use diagnostics; to a poem. Look after the readmore to see Perls objections to my poem if you add use strict!

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2022-05-23 21:30 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (82 votes). Check out past polls.