PERL:
-
#!/usr/bin/perl
-
# perl-grep3.pl
-
#qr// is a regex quoting operator that stores my regex in a scalar
-
#qr// compiles the pattern so it ready to use
-
#eval operator around the qr// to catch the error
-
while( <> )
-
{
-
#The $& variable holds the portion of the string that matched
-
}
ex:
perldoc -t perl | perl-grep3.pl "\b(\S)\S\1\b"
output:
perl587delta Perl changes in version 5.8.7
matched >>>.8.<<<
Tags: Perl