- or download this
# File: defect1.pl
use strict;
...
$str =~ /\G(\s*)/g or die;
print("match3: pos=", pos($str), "\n");
- or download this
match1: pos=2
match2: pos=2
Died at defect1.pl line 13.
- or download this
use strict;
use warnings;
...
my ($x) = ($str =~ /\G(x)/g) or die;
defined(pos($str)) or warn("pos() is undefined!\n");
print("this should be x:$x\n");
- or download this
pos() is undefined!
this should be x:x
- or download this
use strict;
use warnings;
...
my $x = ($str =~ /\G(x)/g)[0] or die;
defined(pos($str)) or warn("pos() is undefined!\n");
print("this should be x:$x\n");
- or download this
pos() is undefined!
this should be x:x
- or download this
use strict;
use warnings;
...
my $x = $1;
defined(pos($str)) or warn("pos() is undefined!\n");
print("this should be x:$x\n");
- or download this
this should be x:x
- or download this
This is perl 5, version 14, subversion 2 (v5.14.2) built for x86_64-li
+nux-thread-multi