Thanks Steve, That did the trick! Going through 'perldoc perlop' now :-)
On Mon, May 10, 2010 at 9:16 PM, Steve Bertrand <st...@ipv6canada.com>wrote: > On 2010.05.10 11:25, Vimal Kumar wrote: > > Hi all, > > > > I am relatively new to Perl. Was learning references and thought of > creating > > a script that will list the username and its list of domains from > httpd.conf > > (on a cpanel server). I am curious to know why line > > > > if (/DocumentRoot \/home\/(\S+?)\//) { > > > > works whereas > > > > if (#DocumentRoot /home/(\S+?)/#) { > > You need to change the delimiter with 'm': > > #!/usr/bin/perl > > use warnings; > use strict; > > my $str = "DocumentRoot /home/a1/"; > > if ( $str =~ m#DocumentRoot /home/(\S+?)/#) { > > print "$str\n"; > } > > See 'perldoc perlop', specifically the "Quote and Quote-like Operators". > > Steve >