Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

dirac's scratchpad

by dirac (Beadle)
on Dec 14, 2004 at 10:56 UTC ( [id://414673]=scratchpad: print w/replies, xml ) Need Help??

# coding stuffs ################################################# @n = (1,2,3,4,5,6,7,8,9,30,21,33,12,76,45,89,11); @even = grep { not $_ % 2 } @n; print "Even: @even\n"; @odd = grep { $_ % 2 } @n; print "Odd: @odd\n"; ################################################# $s = "root ps1 Oct"; ($users, $ttys) = ($s =~ /(\S+)\s+(\S+)/); print "users: $users\nttys: $ttys\n"; ################################################# %ent = ('&'=>'amp', '<'=>'lt', '>'=>'gt'); $html = "this is > of 5 & is < of 10\n"; print $html; $html =~ s/([&<>])/&$ent{$1};/g; print $html; ################################################ %score =<<'EOF' =~ /^(.*?):\s*(.*)/mg; fred: 201 barny: 195 denis: 30 EOF foreach (keys %score) {print $score{$_}, "\t", $_,"\n";} ################################################ $path ="/usr/local/my/path/to/filename"; $filename = (split/\//,$path)[-1]; print "Filename: ",$filename,"\n"; ################################################ @n = qw(as3e cf5e gt55 23ddf 34tt6rr); print "n: @n\n"; for(@n){tr/0-9//d} # print "n: @n\n"; @p = grep /(\w)\1/, @n; print "@p\n"; ################################################ push @xyz, [ split ] while (<DATA>); foreach $pt (@xyz){ print "point ", $p++, ": x= $pt->[0], y = $pt->[1], z = $pt->[2]\n +"; } @mag = map { sqrt($_->[0] * $_->[0] + $_->[1] * $_->[1] + $_->[2] * $_->[2] ) } @xyz; __DATA__ 1 2 3 8 5 6 7 8 9 ################################################ my @addrs = qw( name@example.org rjt@cpan.org Name@example.org rjt@CPAN.org user@alpha.example.org ); my @sort = map { $_->[0] } sort { lc($a->[1][1]) cmp lc($b->[1][1]) or $a->[1][0] cmp +$b->[1][0] } map { [ $_ , [ split '@' ] ] } @addrs; print "@sort\n"; ################################################
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-04-16 05:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found