Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: What would you put on a Perl mug?

by leriksen (Curate)
on Oct 27, 2005 at 07:45 UTC ( #503267=note: print w/ replies, xml ) Need Help??


in reply to What would you put on a Perl mug?

If only

s/empty/coffee/mug;

was valid syntax.

That said, something that disproves perls reputation for being write-only is a good start.

...reality must take precedence over public relations, for nature cannot be fooled. - R P Feynmann


Comment on Re: What would you put on a Perl mug?
Download Code
Re^2: What would you put on a Perl mug?
by liz (Monsignor) on Oct 27, 2005 at 10:43 UTC
    There's always: $mug =~ s/^$/coffee/; ;-) Although it would be more like: $mug =~ s/^$/tea/ for me, personally ;-)
      Hmmm, that would mean if there's a bit of cold coffee from yesterday, you're stuck - you aren't getting fresh coffee.
      $mug =~ s/.*/coffee/s, sleep(1500 + rand 600) while 1;
      Or maybe:
      $mug =~ s/.*/beer/s, sleep(1500 + rand 600) while 1;
      Perl --((8:>*
        I guess I don't like stale coffee in my mug.
        foreach (@days) { my $mug = 'coffee'; # rest of the day }
        would be a more desirable description. ;-)
Re^2: What would you put on a Perl mug?
by merlyn (Sage) on Oct 27, 2005 at 17:15 UTC
      And more importantly:
      $mug->refill( $name_your_poison ) if $mug->is_empty;
        and, derivatively from this thread:
        #!C:/perl/bin system ("cls"); print "\n"; $COFFEE = "COFFEE"; $mug = "mug"; print "\n\t $mug->refill( $COFFEE )\n\t if $mug->is_empty;\n\n"; print "\n___________________ small cup\n\n\t\t"; $_='c[_]'; s/\Qc[_]\E/c[~]/; print $_,$/; print "\n\t\t -jbWare\n"; print "\n ++++++++++++++++++++ medium cup\n\n"; $cup1 = "\t /|~~~~~~|\n\t ( | use |\n\t \\| warn;|\n +\t | |\n\t \\____/ \n "; print "$cup1 \n"; print "\t\t\t -ww\n"; print "\n\t====================== large cup\n\n"; print "\t";$a = ".";for ($i=0; $i<20;$i++){print "$a"; }print"\n\t|\t\t |\n\t| use strict;\t |......\n\t| use warn; + |\t |\n\t|\t\t |\t |\n\t|\t\t |\t |\n"; print "\t|\t\t |......\n\t|\t\t |\t\n\t|\t\t |\t\n\t|\t\t |\t\ +n\t";for ($i=0; $i<20;$i++) { print "$a"; } print "\n\t\t\t -softworkz\n"; print "\n\t __________________________ timeless wisdom\n"; print "\n\t\tuse Perl;\n\t\tIt is Perlish, simple and elegant.\n\t\t - +John Krahn\n\n";

        oops! ... no "use strict;
                     use warnings;" in code.
        add:    "require caffeine;"
        (;<}

Re^2: What would you put on a Perl mug?
by kcott (Abbot) on Jul 01, 2013 at 07:47 UTC

    If only

    s/empty/coffee/mug;

    was valid syntax.

    I just stumbled upon this, 8 years after it was written. Now the syntax is valid:

    $ perl -Mstrict -Mwarnings -E '$_ = "empty"; s/empty/coffee/mug; say' coffee

    [In fact, as far as I can tell, it has been valid since 5.14]

    -- Ken

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://503267]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (13)
As of 2014-09-30 16:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (378 votes), past polls