On 11-04-16 08:30 PM, Uri Guttman wrote:
"tx" == tianjun xu writes:
tx> my %hash=();
no need to initialize that to ().
There is always the need. Not that long ago, mod_perl use to use the
same memory as the previous run but it did not zero the memory. You got
what every was in there
Hi John,
thanks for your E-mail. See below for my response.
On Sunday 17 Apr 2011 04:17:32 John W. Krahn wrote:
> Shlomi Fish wrote:
> > On Saturday 16 Apr 2011 09:06:02 Gurunath Katagi wrote:
> >> hi .. i am new to perl ..
> >> i have a input file something pasted as below ..
> >>
> >> 16 50
>
[ Please do not top-post. TIA ]
tianjun xu wrote:
This works.
#!/usr/bin/perl
use strict;
use warnings;
my %hash=();
while(<>){
chomp(my $line=$_);
my($col1, $col2)=split(/\s+/, $line);
Or just:
while ( <> ) {
my ( $col1, $col2 ) = split;
push(@{ $hash{$
Shlomi Fish wrote:
On Saturday 16 Apr 2011 09:06:02 Gurunath Katagi wrote:
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
> "tx" == tianjun xu writes:
tx> my %hash=();
no need to initialize that to ().
tx> while(<>){
tx> chomp(my $line=$_);
why read the line into $_ and then copy it?
while( my $line = <> ) {
also please don't quote entire long emails. quote the needed part and
put your code
On 11-04-16 11:06 AM, tianjun xu wrote:
print "$key";
for (@{ $hash{$key} }){
print " $_";
}
print "\n";
Try:
print "$key @{$hash{$key}}\n";
--
Just my 0.0002 million dollars worth,
Shawn
Confusion is the first step of understanding.
r (@{ $hash{$key} }){
print " $_";
}
print "\n";
}
--- On Sat, 4/16/11, Shlomi Fish wrote:
> From: Shlomi Fish
> Subject: Re: help in scripting
> To: beginners@perl.org
> Cc: "Gurunath Katagi"
> Date: Saturday, April 16, 2011, 2:41
> "AG" == Agnello George writes:
AG> On Sat, Apr 16, 2011 at 2:36 PM, Uri Guttman wrote:
>>
>> AG> open(INPUT_FILE, $filename) or die "cannot opnen file $!";
>>
>> don't use bareword filehandles. this is said all the time here. use
>> lexical handles.
>>
AG> Could you G
On Sat, Apr 16, 2011 at 2:36 PM, Uri Guttman wrote:
>
> AG> open(INPUT_FILE, $filename) or die "cannot opnen file $!";
>
> don't use bareword filehandles. this is said all the time here. use
> lexical handles.
>
Could you Give me a example for lexical handles or reference me to a website .
Th
> "AG" == Agnello George writes:
AG> use strict;
AG> my $filename = $ARGV[0];
AG> my (%tag,$dkey,$dval);
you don't use $dkey or $dval anywhere.
AG> open(INPUT_FILE, $filename) or die "cannot opnen file $!";
don't use bareword filehandles. this is said all the time here. use
lexi
On Sat, Apr 16, 2011 at 11:36 AM, Gurunath Katagi
wrote:
> 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
> "IG" == Ishwor Gurung writes:
IG> [isg@tarzan:perl]# cat -n foo.pl
don't post code with line numbers. then it can't be cut/pasted by
others.
IG> 1#!/usr/bin/env perl
IG> 2use warnings;
IG> 3use strict;
IG> 4use Data::Dumper;
IG> 5o
Hi.
On 16 April 2011 16:06, Gurunath Katagi wrote:
> 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
On Saturday 16 Apr 2011 09:06:02 Gurunath Katagi wrote:
> 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
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 ..
15 matches
Mail list logo