#!/usr/bin/perl my $env = "1 2 3 4 5"; my %h = split //, $env; use Data::Dumper; print Dumper \%h; #### $VAR1 = { '4' => ' ', '1' => ' ', '3' => ' ', '2' => ' ', '5' => undef }; #### s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)