Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

shmem's scratchpad

by shmem (Canon)
on Mar 09, 2006 at 10:35 UTC ( #535366=scratchpad: print w/ replies, xml ) Need Help??

Why does this yup?

#!/usr/bin/perl use Encode; use strict; use warnings; # avoid being beaten to death no warnings "experimental::regex_sets"; my $european_chars_iso8859 = join '', map { chr $_ } (191..207,209..21 +4,216,217..221,223..239,241..246,248..253); my $european_chars_utf8 = encode_utf8(decode('latin1',$european_cha +rs_iso8859)); my $european_chars = "[$european_chars_iso8859] + [$european_chars_utf +8]"; my $valid = "[:print:] + $european_chars"; print "yup\n" if chr(0x82) =~ /^(?[$valid])+$/; __END__ yup

XP in hex, Free Nodelet Settings

<script type="text/javascript"> item = document.evaluate("//center/table/tbody/tr/td`[1]/table`[1]/tbo +dy/tr/td`[2]/table/tbody/tr`[4]/td`[2]/b",document, null, XPathResult +.ORDERED_NODE_SNAPSHOT_TYPE,null).snapshotItem(0); if(item) item.innerHTML = "0x" + parseInt(item.innerHTML).toString(16) +; </script>

foo.pl

#!/usr/bin/perl use strict; my $pat = shift; my $p; { my (%s, %i); my $d = my $c = 1; # our regexp will be inside parens, so first back +ref is 2 $p = join ( "", map { if($s{$_}++){ "\\".$i{$_} } else{ $i{$_}=++$c; $c>$d+1 ? '(?!'.join('|',map{"\\".abs}-$c+1..-$d-1).")(\\w)" : + "(\\w)"; } } split//,$pat ); } print '(',$p,")\n"; open my $fh, '<', shift; my %s; while (<$fh>) { my @l = (); while (/\b($p)\b/g) { push @l, $1 unless $s{$1}++; } print join (", ",@l), $/ if @l; }

try: perl foo.pl fusselkerl /usr/share/dict/words

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2016-08-27 13:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The best thing I ever won in a lottery was:















    Results (380 votes). Check out past polls.