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

Re^4: single quotes not allowing in perl

by vasanthgk91 (Acolyte)
on May 24, 2013 at 13:44 UTC ( #1035138=note: print w/ replies, xml ) Need Help??


in reply to Re^3: single quotes not allowing in perl
in thread single quotes not allowing in perl

why use hyphen symbol very beginning..really i don't know that's why i ask u


Comment on Re^4: single quotes not allowing in perl
Re^5: single quotes not allowing in perl
by hdb (Parson) on May 24, 2013 at 13:47 UTC

    If the hyphen is in the middle of a character class, it defines a range. /[a-z]/ matches any lower case character. In the same way /[ -.]/ defines the range of ASCII characters between " " and "." and these are:  !"#$%&'()*+,-.. If the hyphen is at the start of the class, it will be taken as a hyphen and not to define a range.



Re^5: single quotes not allowing in perl
by tobyink (Abbot) on May 24, 2013 at 13:51 UTC

    Hyphen is used to match ranges like A-Z and 0-9. But sometimes you want to really match hyphen. In this case there are some fairly convoluted and difficult to remember rules specifying when hyphen means hyphen. An easy rule of thumb though is that if the hyphen is at the very beginning or very end of the range, it means hyphen.

    package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name

      thank u i understood why we put a hyphen symbol very beginning matching

Re^5: single quotes not allowing in perl
by Anonymous Monk on May 25, 2013 at 12:05 UTC
    You had used a long word "beginning" (instead of, say, "start"), yet you continue to use "u" instead of "you". Oh, find some punctuation signs & use them appropriately while there.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2014-07-10 08:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (203 votes), past polls