#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; use XML::Twig; my $input_xml = ' true false false false B true false false false C true false false false A '; my $field= $ARGV[0] || 'u_ci_id'; my $twig = 'XML::Twig'->new; $twig->xparse($input_xml); my $root = $twig->root; my @records = $root->children; my @sorted = sort { $b->first_child( $field)->text cmp $a->first_child( $field)->text } @records; for my $record (@sorted) { my @info_tags = $record->children; my @data; for my $info_tag (@info_tags) { push @data, [ $info_tag->name, $info_tag->text ]; } say join ',', map $_->[0] . ': ' . $_->[1], @data; } #### ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,