<div dir="ltr"><div><div>Here is the sample script . hope this helps you</div><div><br></div><div>use strict;</div><div>use warnings;</div><div><br></div><div>my $str =<<EOF;</div><div>16 50</div><div>16 30</div><div>
16 23</div><div>17 88</div><div>17 99</div><div>18 89</div><div>18 1</div><div>EOF</div><div><br></div><div>my $DATA;</div><div><br></div><div>while ($str =~ m/\G((\d+)\s+(\d+)\n)/gc) {</div><div>    push @{$DATA->{$2}}, $3;</div>
<div>}</div><div><br></div><div>foreach my $num (sort keys %$DATA) {</div><div>    print "\n$num ", join (' ', @{$DATA->{$num}});</div><div>}</div></div><div><br></div><div><br></div><div>----</div><div>
Thanks</div><div>Jagadeesh N.Malakannavar</div><div>9448471968</div><br><div class="gmail_quote">2011/4/16 Gurunath Katagi <span dir="ltr"><<a href="mailto:gurunath.katagi@gmail.com">gurunath.katagi@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">hi .. i  am new to perl ..<br>
i have a input file  something pasted as below ..<br>
<br>
16 50 <br>
16 30<br>
16 23<br>
17 88<br>
17 99<br>
18 89 <br>
18 1<br>
..<br>
--<br>
<br>
and i want the output something like this :<br>
16 50 30 23 <br>
17 88 99<br>
18 99 1<br>
<br>
i.e  for each values in the first column, i want the elements in the second column to be a one row ..<br>
<br>
can  be anybody give me psuedocode , to how to go about this ..<br>
thank you<br><font color="#888888"><br>gurunath<br>
</font><br>_______________________________________________<br>
Bangalore-pm mailing list<br>
<a href="mailto:Bangalore-pm@pm.org">Bangalore-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/bangalore-pm" target="_blank">http://mail.pm.org/mailman/listinfo/bangalore-pm</a><br></blockquote></div><br></div>