#!C:/perl/bin
use strict;
use warnings;
use vars qw ($line $line1 );
$line= "onmouseout=\"cs()\">Otani Restaurant & Sushi Bar: Columbus Ohio DiningGuide \
Restaurant...csdkjfhasdkjghlkjhdfgkj";
print "Demonstrate that line_extending_slash after 'Dining Guide ' is not an issue:\n" . $line . "\n\n";
&OP_mod ($line);
&one ($line);
&two ($line);
&Corion ($line);
# and a final test:
$line1 = "now is the time for all good men...";
if ( $line1 =~ /()/ )
{
print "\n In 'final test' at line 21, \$1 is : |$1| \n";
}
else
{
print "no match on empty parens\n";
}
print "done\n";
exit (1);
#########
sub OP_mod # after Corion, placing \QE differently and using || for match delimiters
{
if ( $line =~ m|onmouseout=\Q"cs()"\E>(.*)| )
{
print "\t \$1 is: $1\n";
}
else
{
print "No match in sub OP_mod\n";
}
return ();
}
sub one
{
if ( $line =~ m|onmouseout=.cs.{3}>(.*)| ) # 3 chars between "cs" and ">" -- (, ), and escaped double_quote
{
print "\t \$1 is: $1\n";
}
else
{
print "No match in sub one\n";
}
return ();
}
sub two
{
if ( $line =~ m|cs().>(.*)\Q\E| )
{
print "\t,in sub two, \$1 is: $1 and \$2 is $2\n";
}
else
{
print "No match in sub two\n";
}
return;
}
sub Corion
{
if ( $line =~ m@\Qonmouseout="cs()">\E(.*)\Q\E@ )
{
print "in subCorion, \$1 is: $1\n";
}
else
{
print "No match in subCorion\n";
}
# next two lines, uncommented, return exact original of $line, less the trailing line_extending_slash
$line =~ m@\Qonmouseout="cs()">\E(.*)\Q\E@;
print "\n -- \$line after exact replica of Corion's: $line \n";
return;
}
=HEAD output under w2k, perl v 5.8.6, with CLI (DOS) window set to width = 255
C:\_perl\pl_test>perl r1109.pl
Demonstrate that line_extending_slash after 'Dining Guide ' is not an issue:
onmouseout="cs()">Otani Restaurant & Sushi Bar: Columbus Ohio DiningGuide
Restaurant...csdkjfhasdkjghlkjhdfgkj
No match in sub OP_mod
No match in sub one
No match in sub two
No match in subCorion
-- $line after exact replica of Corion's: onmouseout="cs()">Otani Restaurant & Sushi Bar: Columbus Ohio DiningGuide
Restaurant...csdkjfhasdkjghlkjhdfgkj
In 'final test' at line 21, $1 is : ||
done
C:\_perl\pl_test>
=cut