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

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to