in reply to Re^2: single quotes not allowing in perl
in thread single quotes not allowing in perl
Be careful! You have lost the ~ in your match. And you need to place the - at the beginning of the character class. See this example:
use strict; use warnings; my $title = 'have ++ fun#'; if($title=~qr(^([a-zA-Z0-9 -.()%&:;,"'/]+)$)) { print "Do my work 1\n"; } if($title=~qr(^([-a-zA-Z0-9 .()%&:;,"'/]+)$)) { print "Do my work 2\n"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: single quotes not allowing in perl
by AnomalousMonk (Archbishop) on May 24, 2013 at 18:00 UTC | |
Re^4: single quotes not allowing in perl
by vasanthgk91 (Sexton) on May 24, 2013 at 13:44 UTC | |
by hdb (Monsignor) on May 24, 2013 at 13:47 UTC | |
by tobyink (Canon) on May 24, 2013 at 13:51 UTC | |
by vasanthgk91 (Sexton) on May 24, 2013 at 13:54 UTC | |
by Anonymous Monk on May 25, 2013 at 12:05 UTC |
In Section
Seekers of Perl Wisdom