http://www.perlmonks.org?node_id=1013775


in reply to Re^2: Need help in parsing an input
in thread Need help in parsing an input

Hello again sandeepda,

I’m sorry, but I don’t understand what you are asking.

The only thought that comes to mind is that you may be unfamiliar with Perl’s special DATA filehandle. But I used that only for convenience. If you already have the data in an array, you would adapt the opening of my script as follows:

for (@existing_array) {

On the other hand, if the data is in a file (named, say, “ports.dat”), then you would begin like this:

my $file = 'ports.dat'; open(my $fh, '<', $file) or die "Cannot open '$file' for reading: $!"; while (<$fh>) {

If this doesn’t answer your question, please explain what you are asking with your version of the code together with sample input and the output you want. See How do I post a question effectively?

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,