N
Nathan
Hi,
The definition of the m?? operator says that it only matches once
between calls to reset. When I ran the following program I confirmed
this behavior:
#!/usr/bin/perl
$_ = "Bilbo Baggins";
for($i=0;$i<5;$i++) {
$a = ?Bilbo?;
}
That is, $a was set to 1 initially and then '' on every pass through the
loop afterward. However, $a does not seem to be set to 1 at all in this
program:
#!/usr/bin/perl
$_ = "Bilbo Baggins";
for (0..4) {
$a = ?Bilbo?;
}
Initially $a is not defined and then it stays '' on each loop pass. I am
running perl v5.8.8 on linux. My understanding is these two programs are
supposed to be equivalent, so why am I observing different behavior with
the debugger in the second one?
-Nathan
The definition of the m?? operator says that it only matches once
between calls to reset. When I ran the following program I confirmed
this behavior:
#!/usr/bin/perl
$_ = "Bilbo Baggins";
for($i=0;$i<5;$i++) {
$a = ?Bilbo?;
}
That is, $a was set to 1 initially and then '' on every pass through the
loop afterward. However, $a does not seem to be set to 1 at all in this
program:
#!/usr/bin/perl
$_ = "Bilbo Baggins";
for (0..4) {
$a = ?Bilbo?;
}
Initially $a is not defined and then it stays '' on each loop pass. I am
running perl v5.8.8 on linux. My understanding is these two programs are
supposed to be equivalent, so why am I observing different behavior with
the debugger in the second one?
-Nathan