Tag Archives: perl

Follow-up to Perl not for dummies

So if I were to write that bit of Perl code I posted about 3 days ago in Ruby (using the additional functionality provided by Rails), it would look like this: hash = Hash.from_xml(res.content)service_id = hash[‘service’][‘id’]hash[‘service’][‘activities’].each do |item| if item[‘name’] … Continue reading

Posted in Computing | Tagged , ,

Perl is not for dummies, I’m living proof

Let’s start with the following (ugly) Perl code snippet. my $xs = new XML::Simple(ForceArray => 1, KeyAttr => [ ]);my $xml = $xs->XMLin($res->content);$service_id = $xml->{service}->[0]->{id}->[0]->{content};foreach my $item (@{$xml->{service}->[0]->{activities}->[0]->{activity}}) {if ($item->{name}->[0] eq $activity) { $activity_id = $item->{id}->[0]->{content}; last;}} Where to begin? … Continue reading

Posted in Compiling | Tagged , ,