Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

!1's scratchpad

by !1 (Hermit)
on Jun 04, 2004 at 23:22 UTC ( [id://361260]=scratchpad: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl -l
    
    ...
    
    
    __END__
    
  2. or download this
    #!/usr/bin/perl -l
    
    ...
    __END__
    Tom=HASH(0x18d0b48)
    Can't locate object method "out" via package "Tom" at safetest.pl line
    + 17.
    
  3. or download this
    perl -le'print 2**38'
    
  4. or download this
    perl -le'$_="@ARGV";tr/a-z/c-zab/;print' "text"
    
  5. or download this
    perl -pe's/[\W_]//g' file
    
  6. or download this
    perl -ne'print $1 while /(?<![A-Z])[A-Z]{3}([a-z])[A-Z]{3}(?![A-Z])/g'
    + file
    
  7. or download this
    #!/usr/bin/perl -wl
    
    ...
       print;
       ($_)= /(\d+)$/g
    }
    
  8. or download this
    import pickle
    
    print pickle.load(open('banner.p','r'))
    
  9. or download this
    python script.py | perl -e'$_=eval <STDIN>;for (@$_) { while(($a,$b
    )=splice(@$_,0,2)) {print $a x $b}print $/}'
    
  10. or download this
    #!/usr/bin/perl -wl
    
    ...
    }
    
    print $comment
    
  11. or download this
    #!/usr/bin/perl -w
    
    ...
    }
    
    print $/;
    
  12. or download this
    perl -le'print map chr, @ARGV' numbers
    
  13. or download this
    #!/usr/bin/perl
    
    ...
    binmode $x;
    print $x $i->jpeg();
    close $x;
    
  14. or download this
    perl -le'$_=1; s/((.)\2*)/length($1).$2/ge while $a++ < 30; print leng
    +th $_'
    
  15. or download this
    #!/usr/bin/perl
    
    ...
    binmode $x;
    print $x $i->jpeg();
    close $x;
    
  16. or download this
    perl -ne'BEGIN{undef$/;$a=shift;@ARGV=q[evil2.gfx];binmode(STDOUT)}for
    +(;defined($x=substr($_,$a,1));$a+=5){print$x}' number > out.type
    
  17. or download this
    perl -MRPC::XML::Client -le'print RPC::XML::Client->new(q[http://www.p
    +ythonchallenge.com/pc/phonebook.php])->send_request(qw[phone Bert])->
    +value'
    
  18. or download this
    #!/usr/bin/perl
    
    ...
    binmode $w;
    print $w $n->jpeg(100);
    close $w;
    
  19. or download this
    perl -MDateTime -le'print for grep { $a=DateTime->new(year=>$_,month=>
    +1,day=>26);$a->day_of_week == 1 and $a->is_leap_year } map { sprintf 
    +q[1%02d6], reverse 0..99 }'
    
  20. or download this
  21. or download this
    Table Items:
    itemid | name
    ...
    Foreign key itemid -> Items.itemid
    
  22. or download this
    my $iter = ( 
        DBSchema::ShoppingCart->only_fields("name_on_cart")
      + DBSchema::Items->where(name => [ qw(Teddies Trampolines) ]
    )->execute;
    
  23. or download this
    SELECT ShoppingCart.name_on_cart from ShoppingCart where ShoppingCart.
    +cartid IN (SELECT ShoppingCartItems.cartid from ShoppingCartItems inn
    +er join Items on ShoppingCartItems.itemid = Items.itemid where Items.
    +name in ('Teddies','Trampolines'))
    
  24. or download this
    my $iter =  ( 
        DBSchema::ShoppingCart->only_fields("name_on_cart") 
    ...
      + DBSchema::Items->where(name => "Trampolines") 
      - DBSchema::Items->where(name => ["!=", [ qw(Teddies Trampolines) ] 
    +] )
    )->execute();
    
  25. or download this
    SELECT ShoppingCart.name_on_cart from ShoppingCart where ShoppingCart.
    +cartid IN (SELECT ShoppingCartItems.cartid from ShoppingCartItems inn
    +er join Items on ShoppingCartItems.itemid=Items.itemid where Items.na
    +me = 'Teddies') AND ShoppingCart.cartid IN (SELECT ShoppingCartItems.
    +cartid from ShoppingCartItems inner join Items on ShoppingCartItems.i
    +temid=Items.itemid where Items.name = 'Trampolines') AND ShoppingCart
    +.cartid NOT IN (SELECT ShoppingCartItems.cartid from ShoppingCartItem
    +s inner join Items on ShoppingCartItems.itemid=Items.itemid where Ite
    +ms.name NOT IN ('Teddies','Trampolines'))
    
  26. or download this
    SELECT DISTINCT ShoppingCartItems.cartid from ShoppingCartItems inner 
    +join Items on ShoppingCartItems.itemid=Items.itemid where Items.name=
    +'Teddies';
    
    ...
    - collects results, calculates the intersection from first two and the
    +n the difference of the intersection and the third query -
    
    SELECT ShoppingCart.name_on_cart from ShoppingCart where ShoppingCart.
    +cartid=2;
    
  27. or download this
    package Attribute::Scary;
    
    ...
    }
    
    1;
    
  28. or download this
    #!/usr/bin/perl -l
    
    ...
        FLAGS = 0x0
        PADLIST = 0x816724c
        OUTSIDE = 0x811b2ac (MAIN)
    
  29. or download this
    sub randChar {
        my ($chars,$len,$inc,$exl) = split /-/, shift;
    ...
        my @map = keys %map or return;
        join "",map $map[rand @map],1..$len
    }
    
  30. or download this
    use Scalar::Util "weaken";
    use vars qw(%STORE);
    ...
    }
    
    ...
    
  31. or download this
    my $var = 1;
    $_string = $var;
    ...
    MatchVars->string($var);
    $var = 2;
    print $_string; # prints 2
    
  32. or download this
    package MatchVars;
    
    ...
    print "3: $_prematch | $_match | $_postmatch" if $var3 =~ /=\w+=/;
    # this | =shows= | up
    

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 imbibing at the Monastery: (2)
As of 2024-04-25 07:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found