You want to start the code with these:
use warnings;
use strict;
> if(/,/) {print "before match: $`\t and after match: $'\n\n";};
> $x=$';
> $y=$`;
> &mysubroutine($x,$y);
Should be:
if(/,/) {
print "before match: $`\t and after match: $'\n\n";
$x=$';
$y=$`;
mysubroutine($x,$y);
}
No ';' at the end of the if block. Drop the & before the sub call.
Or ever do this:
if(/,/) {
print "before match: $`\t and after match: $'\n\n";
mysubroutine($', $`);
}
But what's really broken is this (in the sub):
> $a=$x;
> $b=$y;
Should be:
my ($a, $b) = @_;
I /think/ $x, $y are not defined in the sub.
So this is wrong, too:
> print "pattern to find: $y\n";
> if (/$b/) {print "[EMAIL PROTECTED]";};
No $y defined here. Stick with $b
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/