Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^2: Pugs Tic Tac

by bmann (Priest)
on Apr 25, 2005 at 18:33 UTC ( [id://451298]=note: print w/replies, xml ) Need Help??


in reply to Re: Pugs Tic Tac
in thread Pugs Tic Tac

~~ is called the "smart match operator" and supersedes the binding operator, =~. It allows you to use it on anything and it'll do the right thing, ie:
$i = 1; if ( $i ~~ 1 ) { # $i == 1 $i = 'foo'; if ( $i ~~ 'foo' ) { # $i eq 'foo' $i = 'foo'; if ( $i ~~ m/fo(.)/ ) { # $1 contains 'o'
Read the "Smart Matching" section of Synopsis 4 for details.

rx is a replacement for qr. rx:perl5 means use perl5-compatible regular expressions. More details about rx in Synopsis 5.

Replies are listed 'Best First'.
Re^3: Pugs Tic Tac
by eric256 (Parson) on Apr 25, 2005 at 20:37 UTC

    Thanks for the links. Are we sure this new language is perl? I mean it looks like perl, but it sure aint the same thing. Anyone else completly terrified by the need to learn a new language? I know it is not a need, and it does look quite cool, but I just feel like i'm getting the hang of 5.8. ;)


    ___________
    Eric Hodges
      Are we sure this new language is perl? I mean it looks like perl, but it sure aint the same thing.

      It's certainly not the same, but to me it still feels like Perl. A lot has changed, but the spirit seems very much intact.

      Anyone else completly terrified by the need to learn a new language? I know it is not a need, and it does look quite cool, but I just feel like i'm getting the hang of 5.8.

      Well, as you said, it's not something you're going to need to do right away. Perl 5 is not going away any time soon, so your skills will be useful for a long time to come.

      Even if Perl 5 was taken away from us the moment Perl 6 was released, much of the language is only changed in a superficial sense. In general, the old ways will still be there for the taking, they'll just be sometimes clunky and obtuse compared to the shiny new ways of solving the same problems.

      PS: if anyone wonders why I've posted so much in this thread, it's because I'm excited about Perl6, and welcome any discussion about it. Hopefully that doesn't come across as obsessed and attention crazed, but sometimes you take that risk. :-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2024-04-23 13:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found