User:Texas.william/perl/zomdic: Difference between revisions

From The Urban Dead Wiki
Jump to navigationJump to search
(Code written to <span> id the entire kiZombie dictionary.)
 
mNo edit summary
 
Line 1: Line 1:
  #!/usr/bin/perl
  #!/usr/bin/perl
  open FIN,'data' or die "file not found";
  open FIN,'data' or die 'file not found';
  @data=<FIN>;
  @data=<FIN>;
  close FIN;
  close FIN;

Latest revision as of 06:03, 28 June 2009

#!/usr/bin/perl
open FIN,'data' or die 'file not found';
@data=<FIN>;
close FIN;
print "$#data lines read.\n";

open FOUT,'>newdata' or die 'unable to open file newdata for writing';
foreach(@data) {
    if (! /^#/) {
        s|^'{3}(.*?)'{3}|<span id="$1">'''$1'''</span>|;
    }
    print FOUT;
}
close FOUT;

print "Operation completed.\n"