Changes between Version 12 and Version 13 of Perl


Ignore:
Timestamp:
09/25/06 11:39:17 (18 years ago)
Author:
atzm
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Perl

    v12 v13  
    415415$ perl -e '@A=reverse split//,$ARGV[0];for(@A){$s+=(ord($_)-96)*(26**$i++)};print $s-1,"\n";'  
    416416}}} 
     417 
     418== HTML 関連 == 
     419=== 実体参照,文字参照をほげる === 
     420{{{ 
     421#!perl 
     422my %entref_map = ( 
     423     amp  => "&", 
     424     apos => "'", 
     425     gt   => ">", 
     426     lt   => "<", 
     427     nbsp => " ", 
     428     quot => '"', 
     429); 
     430 
     431$body =~ s/&(\w+?);/$entref_map{$1}/ge;         # entityref 
     432$body =~ s/&#([0-9]+?);/chr($1)/ge;             # dec charref 
     433$body =~ s/&#x([0-9A-Fa-f]+?);/chr(hex($1))/ge; # hex charref 
     434}}} 
     435 * こういうのもあるらしい http://www.kawa.net/works/perl/i18n-emoji/EntityRef.pm.html