Corion, Thanks for the note.
I put in the following lines;
1 #!/usr/bin/perl -w
4 use strict;
5 use Data::Dumper;
6 $|=1; #makes the macro produce all results at once, not in spurts
8 my $filename = "RAH99.html";
9 my $output = $filename;
10 my $backupoutput = 1; #New from Corion
11 my $backupoutput = 2; # you will get the warning here
12 print $backupoutput; # New from Corion
13 my $backupoutput = $filename;
14 print $backupoutput;
15 my $backupoutput =~ s{\.html*}{.entbackup.html}i;
17 open (IN, $filename);
18 my $book = join('',<IN>);
19 close IN;
21 open (OUT, ">$backupoutput");
22 print OUT $book;
23 close OUT;
26 $book =~ s/‘/‘/g;
27 $book =~ s/’/’/g;
Many more lines of character change
83 $book =~ s/û/û/g;
84 $book =~ s/ü/ü/g;
86 my $utf8 = qq!<meta http-equiv="Content-Type" content="text/html; c
+harset=UTF-8" />!;
88 $book = "I have changed the most common Unicode characters into HTM
+L entities.\n\nUse this search term to find any leftovers: [€-ÿ]\n\nA
+lso, don't forget to add a UTF-8 meta tag to your header:\n\n$utf8\n\
+n".$book;
91 open (OUT, ">$filename") or die "Couldn't create '$filename': $!";
+ #New from Corion
92 print OUT $book;
93 close OUT;
And so I got:
C:\Perl64\bin>perl entities_99.pl
"my" variable $backupoutput masks earlier declaration in same scope at
+ entities_99.pl line 11.
"my" variable $backupoutput masks earlier declaration in same scope at
+ entities_99.pl line 13.
"my" variable $backupoutput masks earlier declaration in same scope at
+ entities_99.pl line 15.
2RAH99.htmlUse of uninitialized value $backupoutput in substitution (s
+///) at entities_99.pl line 15.
Use of uninitialized value $backupoutput in concatenation (.) or strin
+g at entities_99.pl line 21.
print() on closed filehandle OUT at entities_99.pl line 22.
Does this suggest a new approach? |