#!/usr/bin/perl use strict; use warnings; use XML::Twig; use XML::Simple; use JSON::XS; use YAML::Syck; use Data::Dumper; use Storable; use Fatal qw(open read close); my $xml; while(){ $xml .= $_; } my $twig = XML::Twig->new(); my $href = XMLin($xml); my $dumper = Dumper($href); my $storable = Storable::freeze($href); my $json = encode_json($href); my $yaml = Dump($href); use Benchmark qw( cmpthese ); cmpthese -5, { 'XML::Simple' => sub { XMLin($xml) }, 'XML::Twig' => sub { $twig->parse($xml) }, 'JSON::XS' => sub { decode_json($json) }, 'YAML::Syck' => sub { Load($yaml) }, 'Storable' => sub { Storable::thaw($storable) }, 'Data::Dumper' => sub { eval($dumper) }, }; __DATA__ Basic bread Flour Yeast Water Salt Mix all ingredients together. Knead thoroughly. Cover with a cloth, and leave for one hour in warm room. Knead again. Place in a bread baking tin. Cover with a cloth, and leave for one hour in warm room. Bake in the oven at 180(degrees)C for 30 minutes.