texuser74 has asked for the wisdom of the Perl Monks concerning the following question:
desired output:$/ = "</address>\n"; while ( <DATA> ) { chomp; print "$_\n" for sort { $a cmp $b} split /\n/; print $/ if ! eof DATA; } __DATA__ xxx data aaa data <address> <state>address1</state> <ref refid="aff1">1</ref> <ref refid="aff2">2</ref> <ref refid="e2"/> <ref refid="e4"/> <ref refid="aff4">4</ref> </address> <address> <state>address1</state> <ref refid="aff1">1</ref> <ref refid="aff2">2</ref> <ref refid="e4"/> <ref refid="aff3">3</ref> </address> xxx data aaa data
Thanks in advancexxx data aaa data <address> <state>address1</state> <ref refid="aff1">1</ref> <ref refid="aff2">2</ref> <ref refid="aff4">4</ref> <ref refid="e2"/> <ref refid="e4"/> </address> <address> <state>address1</state> <ref refid="aff1">1</ref> <ref refid="aff2">2</ref> <ref refid="aff3">3</ref> <ref refid="e4"/> </address> xxx data aaa data
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: difficulty in sorting
by GrandFather (Saint) on Aug 21, 2008 at 05:10 UTC | |
by texuser74 (Monk) on Aug 21, 2008 at 06:13 UTC | |
|
Re: difficulty in sorting
by Tanktalus (Canon) on Aug 21, 2008 at 05:04 UTC | |
by texuser74 (Monk) on Aug 21, 2008 at 05:40 UTC | |
by RMGir (Prior) on Aug 21, 2008 at 09:21 UTC | |
|
Re: difficulty in sorting
by juster (Friar) on Aug 21, 2008 at 06:29 UTC | |
|
Re: difficulty in sorting
by massa (Hermit) on Aug 21, 2008 at 10:10 UTC |