grammarian
Programmer
Hi.
Here's the thing.
I have ActivePerl running on a WinXP and I'm doing this at the command
line:
perl o.pl e.txt r.txt
And this is the program o.pl:
$source=$ARGV[0];
$dest=$ARGV[1];
unless($source and $dest){
print "Source or destination file missing\n";
}
open SOURCE, "<$source";
open DEST, ">$dest";
while(<SOURCE>){
if($_ =~ m/tag(.*)/s) {
print DEST "$1\n";
}
}
close SOURCE;
close DEST;
And this is the e.txt file:
tag">word</div>
<div class="okay">
<i>o.</i> notgood,
Now I can see that here in the forum, as well as in the regex tester,
it shows up in several lines. My notepad, however, displays it on one
single line. But if I copy this now and paste it there then it shows up
in multiple lines like above.
Now when I go here:
and paste e.txt into the source textbox and tag(.*) into the pattern
textbox, and turn on Single Line and then turn off the other four, it
says my $1 is:
">word</div> <div class="okay"> <i>o.</i> notgood,
Which is correct! Then why doesn't my ActivePerl says so? Its r.txt
output is:
">word</div>
And that's obviously NOT what I want!! I have no idea why this is
happening. Do you have any idea what's happening?.
Thank you.
Here's the thing.
I have ActivePerl running on a WinXP and I'm doing this at the command
line:
perl o.pl e.txt r.txt
And this is the program o.pl:
$source=$ARGV[0];
$dest=$ARGV[1];
unless($source and $dest){
print "Source or destination file missing\n";
}
open SOURCE, "<$source";
open DEST, ">$dest";
while(<SOURCE>){
if($_ =~ m/tag(.*)/s) {
print DEST "$1\n";
}
}
close SOURCE;
close DEST;
And this is the e.txt file:
tag">word</div>
<div class="okay">
<i>o.</i> notgood,
Now I can see that here in the forum, as well as in the regex tester,
it shows up in several lines. My notepad, however, displays it on one
single line. But if I copy this now and paste it there then it shows up
in multiple lines like above.
Now when I go here:
and paste e.txt into the source textbox and tag(.*) into the pattern
textbox, and turn on Single Line and then turn off the other four, it
says my $1 is:
">word</div> <div class="okay"> <i>o.</i> notgood,
Which is correct! Then why doesn't my ActivePerl says so? Its r.txt
output is:
">word</div>
And that's obviously NOT what I want!! I have no idea why this is
happening. Do you have any idea what's happening?.
Thank you.