[Bangalore-pm] Bangalore-pm Digest, Vol 30, Issue 3

Shantanu Bhadoria shantanu.bhadoria at gmail.com
Sun Apr 17 20:48:11 PDT 2011


Gurunath, This is an ideal situation to use map. Thats the more perlish way

On Sun, Apr 17, 2011 at 12:30 AM, <bangalore-pm-request at pm.org> wrote:

> Send Bangalore-pm mailing list submissions to
>        bangalore-pm at pm.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://mail.pm.org/mailman/listinfo/bangalore-pm
> or, via email, send a message with subject or body 'help' to
>        bangalore-pm-request at pm.org
>
> You can reach the person managing the list at
>        bangalore-pm-owner at pm.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Bangalore-pm digest..."
>
>
> Today's Topics:
>
>   1. help in scripting (Gurunath Katagi)
>   2. Re: help in scripting (Jagadeesh N. Malakannavar)
>   3. Re: help in scripting (Gurunath Katagi)
>   4. Re: help in scripting (Jagadeesh N. Malakannavar)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sat, 16 Apr 2011 11:03:59 +0530
> From: Gurunath Katagi <gurunath.katagi at gmail.com>
> To: bangalore-pm at pm.org
> Subject: [Bangalore-pm] help in scripting
> Message-ID: <BANLkTi=ipgTajULJOsq7UGCNa+guQttMDQ at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> hi .. i am new to perl ..
> i have a input file something pasted as below ..
>
> 16 50
> 16 30
> 16 23
> 17 88
> 17 99
> 18 89
> 18 1
> ..
> --
>
> and i want the output something like this :
> 16 50 30 23
> 17 88 99
> 18 99 1
>
> i.e for each values in the first column, i want the elements in the second
> column to be a one row ..
>
> can be anybody give me psuedocode , to how to go about this ..
> thank you
>
> gurunath
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mail.pm.org/pipermail/bangalore-pm/attachments/20110416/83e60b7a/attachment-0001.html
> >
>
> ------------------------------
>
> Message: 2
> Date: Sat, 16 Apr 2011 11:19:23 +0530
> From: "Jagadeesh N. Malakannavar" <mnjagadeesh at gmail.com>
> To: Gurunath Katagi <gurunath.katagi at gmail.com>
> Cc: bangalore-pm at pm.org
> Subject: Re: [Bangalore-pm] help in scripting
> Message-ID: <BANLkTimR6ohd4j3bdiVBCgXRgzU3Xy8eFA at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Here is the sample script . hope this helps you
>
> use strict;
> use warnings;
>
> my $str =<<EOF;
> 16 50
> 16 30
> 16 23
> 17 88
> 17 99
> 18 89
> 18 1
> EOF
>
> my $DATA;
>
> while ($str =~ m/\G((\d+)\s+(\d+)\n)/gc) {
>    push @{$DATA->{$2}}, $3;
> }
>
> foreach my $num (sort keys %$DATA) {
>    print "\n$num ", join (' ', @{$DATA->{$num}});
> }
>
>
> ----
> Thanks
> Jagadeesh N.Malakannavar
> 9448471968
>
> 2011/4/16 Gurunath Katagi <gurunath.katagi at gmail.com>
>
> > hi .. i am new to perl ..
> > i have a input file something pasted as below ..
> >
> > 16 50
> > 16 30
> > 16 23
> > 17 88
> > 17 99
> > 18 89
> > 18 1
> > ..
> > --
> >
> > and i want the output something like this :
> > 16 50 30 23
> > 17 88 99
> > 18 99 1
> >
> > i.e for each values in the first column, i want the elements in the
> second
> > column to be a one row ..
> >
> > can be anybody give me psuedocode , to how to go about this ..
> > thank you
> >
> > gurunath
> >
> > _______________________________________________
> > Bangalore-pm mailing list
> > Bangalore-pm at pm.org
> > http://mail.pm.org/mailman/listinfo/bangalore-pm
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mail.pm.org/pipermail/bangalore-pm/attachments/20110416/66563870/attachment-0001.html
> >
>
> ------------------------------
>
> Message: 3
> Date: Sat, 16 Apr 2011 12:13:58 +0530
> From: Gurunath Katagi <gurunath.katagi at gmail.com>
> To: "Jagadeesh N. Malakannavar" <mnjagadeesh at gmail.com>
> Cc: bangalore-pm at pm.org
> Subject: Re: [Bangalore-pm] help in scripting
> Message-ID: <BANLkTikd=gdYrWUFzBb_WuhfMrLyuVQPuw at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> hi ..
> how r u reading the a list of values into a scalar ..
> when i tried this, its taking only one value ..
> please find the input file attached ..
>  and kindly reply ..
>
> Thank you
> gurunath
>
>
> On Sat, Apr 16, 2011 at 11:19 AM, Jagadeesh N. Malakannavar <
> mnjagadeesh at gmail.com> wrote:
>
> > Here is the sample script . hope this helps you
> >
> > use strict;
> > use warnings;
> >
> > my $str =<<EOF;
> > 16 50
> > 16 30
> > 16 23
> > 17 88
> > 17 99
> > 18 89
> > 18 1
> > EOF
> >
> > my $DATA;
> >
> > while ($str =~ m/\G((\d+)\s+(\d+)\n)/gc) {
> >     push @{$DATA->{$2}}, $3;
> > }
> >
> > foreach my $num (sort keys %$DATA) {
> >     print "\n$num ", join (' ', @{$DATA->{$num}});
> > }
> >
> >
> > ----
> > Thanks
> > Jagadeesh N.Malakannavar
> > 9448471968
> >
> > 2011/4/16 Gurunath Katagi <gurunath.katagi at gmail.com>
> >
> >> hi .. i am new to perl ..
> >> i have a input file something pasted as below ..
> >>
> >> 16 50
> >> 16 30
> >> 16 23
> >> 17 88
> >> 17 99
> >> 18 89
> >> 18 1
> >> ..
> >> --
> >>
> >> and i want the output something like this :
> >> 16 50 30 23
> >> 17 88 99
> >> 18 99 1
> >>
> >> i.e for each values in the first column, i want the elements in the
> second
> >> column to be a one row ..
> >>
> >> can be anybody give me psuedocode , to how to go about this ..
> >> thank you
> >>
> >> gurunath
> >>
> >> _______________________________________________
> >> Bangalore-pm mailing list
> >> Bangalore-pm at pm.org
> >> http://mail.pm.org/mailman/listinfo/bangalore-pm
> >>
> >
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mail.pm.org/pipermail/bangalore-pm/attachments/20110416/f7fe35cc/attachment-0001.html
> >
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: tr1.dat
> Type: application/x-ns-proxy-autoconfig
> Size: 493 bytes
> Desc: not available
> URL: <
> http://mail.pm.org/pipermail/bangalore-pm/attachments/20110416/f7fe35cc/attachment-0001.bin
> >
>
> ------------------------------
>
> Message: 4
> Date: Sat, 16 Apr 2011 13:34:02 +0530
> From: "Jagadeesh N. Malakannavar" <mnjagadeesh at gmail.com>
> To: Gurunath Katagi <gurunath.katagi at gmail.com>
> Cc: bangalore-pm at pm.org
> Subject: Re: [Bangalore-pm] help in scripting
> Message-ID: <BANLkTik1TyNXYMBhVRLgj7wwM78kQCQ6Tg at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> please find attached files.  if you still have difficulties getting this
> code running let me see your code.
>
>
> Thanks
>
> On Sat, Apr 16, 2011 at 12:13 PM, Gurunath Katagi <
> gurunath.katagi at gmail.com
> > wrote:
>
> > hi ..
> > how r u reading the a list of values into a scalar ..
> > when i tried this, its taking only one value ..
> > please find the input file attached ..
> >   and kindly reply ..
> >
> > Thank you
> > gurunath
> >
> >
> >
> > On Sat, Apr 16, 2011 at 11:19 AM, Jagadeesh N. Malakannavar <
> > mnjagadeesh at gmail.com> wrote:
> >
> >> Here is the sample script . hope this helps you
> >>
> >> use strict;
> >> use warnings;
> >>
> >> my $str =<<EOF;
> >> 16 50
> >> 16 30
> >> 16 23
> >> 17 88
> >> 17 99
> >> 18 89
> >> 18 1
> >> EOF
> >>
> >> my $DATA;
> >>
> >> while ($str =~ m/\G((\d+)\s+(\d+)\n)/gc) {
> >>     push @{$DATA->{$2}}, $3;
> >> }
> >>
> >> foreach my $num (sort keys %$DATA) {
> >>     print "\n$num ", join (' ', @{$DATA->{$num}});
> >> }
> >>
> >>
> >> ----
> >> Thanks
> >> Jagadeesh N.Malakannavar
> >> 9448471968
> >>
> >> 2011/4/16 Gurunath Katagi <gurunath.katagi at gmail.com>
> >>
> >>> hi .. i am new to perl ..
> >>> i have a input file something pasted as below ..
> >>>
> >>> 16 50
> >>> 16 30
> >>> 16 23
> >>> 17 88
> >>> 17 99
> >>> 18 89
> >>> 18 1
> >>> ..
> >>> --
> >>>
> >>> and i want the output something like this :
> >>> 16 50 30 23
> >>> 17 88 99
> >>> 18 99 1
> >>>
> >>> i.e for each values in the first column, i want the elements in the
> >>> second column to be a one row ..
> >>>
> >>> can be anybody give me psuedocode , to how to go about this ..
> >>> thank you
> >>>
> >>> gurunath
> >>>
> >>> _______________________________________________
> >>> Bangalore-pm mailing list
> >>> Bangalore-pm at pm.org
> >>> http://mail.pm.org/mailman/listinfo/bangalore-pm
> >>>
> >>
> >>
> >
>
>
> --
>
> Thanks,
> Jagadeesh N.Malakannavar
> 9448471968
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mail.pm.org/pipermail/bangalore-pm/attachments/20110416/c92f0638/attachment-0001.html
> >
> -------------- next part --------------
> 16 50
> 16 30
> 16 23
> 17 88
> 17 99
> 18 89
> 18 1
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: guru.pl
> Type: application/octet-stream
> Size: 323 bytes
> Desc: not available
> URL: <
> http://mail.pm.org/pipermail/bangalore-pm/attachments/20110416/c92f0638/attachment-0001.obj
> >
>
> ------------------------------
>
> _______________________________________________
> Bangalore-pm mailing list
> Bangalore-pm at pm.org
> http://mail.pm.org/mailman/listinfo/bangalore-pm
>
> End of Bangalore-pm Digest, Vol 30, Issue 3
> *******************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/bangalore-pm/attachments/20110418/3bcb57fc/attachment.html>


More information about the Bangalore-pm mailing list