Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Interpolating Nursery Rhyme

by stephen (Priest)
on Apr 25, 2002 at 16:25 UTC ( #162019=note: print w/replies, xml ) Need Help??

in reply to Interpolating Nursery Rhyme

Hmm... you don't use quotes with numbers. '5' and "5" are the same thing-- a string containing the character '5'. If it's in quotes of any sort, it's a string.

One uses single quotes for strings of literal text. So:

my $bar = 3; my $foo = 'Bar is $bar'; print $foo, "\n";
prints "Bar is $bar".

One uses double quotes for strings that should have variables interpolated. So:

my $bar = 3; my $foo = "Bar is $bar"; print $foo, "\n";
prints "Bar is 3".

So maybe this rhyme can help:

For literal strings, quote with Single. (Isn't this a silly jingle?) Interpolation uses Double. Forget this rule, you'll be in trouble.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://162019]
[erix]: ok, but mainainability comes after it has been made to work :)
[erix]: maybe I should have cobbled together a more simple example
[erix]: the main question is whether repeating groups get captured. I thought they did but it looks they do not.
[erix]: or they probably get overwritten when the repeating is done
[erix]: I'd better split by union/intersect/ except and submit the resulting parts to a simple regex

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2018-01-19 08:41 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (216 votes). Check out past polls.