Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS 

Perl - send form POST

// Manda le informazioni per il login ad un determinato sito

use HTTP::Request::Common qw(POST);
use LWP::UserAgent;

my $user = "user";
my $pass = "pass";

my $browser = LWP::UserAgent->new();

my $responde = HTTP::Request->new(POST => "http://www.sito.com/index.php");
$responde->content_type("application/x-www-form-urlencoded");
$responde->content("user=" . $user . "&pass=" . $pass);

$browser->request($responde)->as_string

Perl - Sostituzione

// converte una data, dal formato 01/12/2006 al formato 2006-12-01

    perl -i.bak -pe 's{(\d\d)/(\d\d)/(\d\d\d\d)}{$3-$2-$1}'
« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS