Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Given When Syntax

by Lennotoecom (Pilgrim)
on Mar 15, 2014 at 19:20 UTC ( #1078478=note: print w/replies, xml ) Need Help??


in reply to Given When Syntax

you can use the dark arts mate ^_^
no stricts, no warnings, no use 5** ^_^,
come to the dark side of the force mate
$switch = chr(int(rand(3)+97)); $switch->(); sub a {print "one\n";} sub b {print "two\n";} sub c {print "three\n";}
p.s. guys dont scold me hard please :)

Replies are listed 'Best First'.
Re^2: Given When Syntax
by LanX (Bishop) on Mar 15, 2014 at 19:56 UTC
    > use the dark arts mate

    maybe a misunderstanding, but I thought black is supposed to be beautiful not ugly! :-b

    sub switch ($$); for my $var (1..4) { my $i; switch $var => { 1 => sub { $i = "One"}, 2 => sub { $i = "Two"}, 3 => sub { $i = "Three"}, '' => sub { $i = "Other"}, }; print "$var is $i\n"; } sub switch ($$) { my ($case, $href) =@_; if ( exists $href->{$case} ) { $href->{$case}->(); } else { $href->{''}->(); } }

    Cheers Rolf

    ( addicted to the Perl Programming Language)

      symbolic references = dark arts no?
        > symbolic references = dark arts no?

        I'm not questioning the "dark" just the "art" in your statement. ;)

        Cheers Rolf

        ( addicted to the Perl Programming Language)

Re^2: Given When Syntax
by Deep_Plaid (Acolyte) on Mar 15, 2014 at 21:06 UTC

    Dark Arts... I like the sound of that. It's so eeeevil. Seriously, though - I appreciate the different perspective and your input. Thanks!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2018-08-17 18:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:









    Results (182 votes). Check out past polls.

    Notices?