Perl: the Markov chain saw | |
PerlMonks |
Re: Matching dot using regexpby Discipulus (Canon) |
on Oct 09, 2017 at 18:14 UTC ( [id://1201029]=note: print w/replies, xml ) | Need Help?? |
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:
Note also that you can split on an alternation /\.|:/ , avoiding the first regex: 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.
In Section
Seekers of Perl Wisdom
|
|