Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Matching dot using regexp

by Discipulus (Canon)
on Oct 09, 2017 at 18:14 UTC ( [id://1201029]=note: print w/replies, xml ) Need Help??


in reply to Matching dot using regexp

The dot has special meaning in regexes. you must escape it:  /\./

See perlrequick for character that must be escaped:

Not all characters can be used as is in a match. Some characters, called metacharacters, are reserved for use in regex notation. The metacharacters are

{}[]()^$.|*+?\

Then if you add a newline to your first print statement print "new time is $tim\n"; or use say the whole output will be clearer.

update please note that you are splitting on any character, resulting in an empty list:

perl -MData::Dump -e "dd split /./, $ARGV[0]" assasas ()

Note also that you can split on an alternation /\.|:/ , avoiding the first regex:

perl -MData::Dump -e "dd split /\.|:/, $ARGV[0]" 10:A.11:B.12 (10, "A", 11, "B", 12)
L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-24 20:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found