Re: perl intersect problem

2008-01-22 Thread Chas. Owens
On Jan 22, 2008 10:56 PM, Vahid Moghaddasi <[EMAIL PROTECTED]> wrote: > On Jan 22, 2008 9:31 PM, Chas. Owens <[EMAIL PROTECTED]> wrote: > > > > Off hand I think that would only happen if the user name or the uid > > was the same for some of your users. Can you present a cleaned up > > version of y

Re: about the dot

2008-01-22 Thread Chas. Owens
On Jan 22, 2008 10:55 PM, Jeff Pang <[EMAIL PROTECTED]> wrote: snip > $ perl -le 'print 3.4 .3. 4' > Number found where operator expected at -e line 1, near "3. 4" > (Missing operator before 4?) > syntax error at -e line 1, near "3. 4" > Execution of -e aborted due to compilation errors. >

Re: perl intersect problem

2008-01-22 Thread Tom Phoenix
On Jan 22, 2008 7:43 PM, Vahid Moghaddasi <[EMAIL PROTECTED]> wrote: > # egrep "^bin:|^adm:|^daemon:|^root:|^rpm:" /etc/passwd > root:x:0:0:Linux root:/root:/bin/bash > bin:x:1:1:Linux bin:/bin:/sbin/nologin > daemon:x:2:2:Linux daemon:/sbin:/sbin/nologin > rpm:x:37:37:Linux :/var/lib/rpm:/sbin/no

Re: perl intersect problem

2008-01-22 Thread Vahid Moghaddasi
On Jan 22, 2008 9:31 PM, Chas. Owens <[EMAIL PROTECTED]> wrote: > > Off hand I think that would only happen if the user name or the uid > was the same for some of your users. Can you present a cleaned up > version of your data the exhibits the problem? Also, You might want > to rewrite your loop

Re: about the dot

2008-01-22 Thread Jeff Pang
-Original Message- >From: Jenda Krynicky <[EMAIL PROTECTED]> >Sent: Jan 23, 2008 12:59 AM >To: beginners-list >Subject: Re: about the dot > >From: Jeff Pang <[EMAIL PROTECTED]> >> I'm a little confused by perl's dot operator.for example, >> >> $ perl -le 'print 3 . 4 ' >> 34 >> $ perl -

Re: perl intersect problem

2008-01-22 Thread Vahid Moghaddasi
On Jan 22, 2008 9:24 PM, Tom Phoenix <[EMAIL PROTECTED]> wrote: > On Jan 22, 2008 5:49 PM, Vahid Moghaddasi <[EMAIL PROTECTED]> wrote: > > > I have the following > > subroutine to sort unique a UNIX password file based on UID and > > username. > > Doesn't your password file already have unique use

Re: Please explain @{$y}

2008-01-22 Thread Chas. Owens
On Jan 22, 2008 9:33 PM, Rob Dixon <[EMAIL PROTECTED]> wrote: snip > > If the code works (and it isn't guarenteed to) > > I'm not sure what you mean here. It's as guaranteed to work as any other > Perl code snippet I've seen. snip I mean that the following is an error. my $foo = 5; my @array = @{

Re: Please explain @{$y}

2008-01-22 Thread Rob Dixon
Chas. Owens wrote: > On Jan 22, 2008 8:45 PM, bootleg86 bootleg86 <[EMAIL PROTECTED]> wrote: I came across this construct foreach $i ( @{$y} ) { #do something } Is @ referring to some default array that doesn't need to be declared? Also it's using the associative version of an array? I alwa

Re: perl intersect problem

2008-01-22 Thread John W. Krahn
Vahid Moghaddasi wrote: Hi, Hello, I have a very strange problem (to me anyways). I have the following subroutine to sort unique a UNIX password file based on UID and username. But the problem is that some of the users get disappeared the output password file. I couldn't figure out the patte

Re: perl intersect problem

2008-01-22 Thread Chas. Owens
On Jan 22, 2008 8:49 PM, Vahid Moghaddasi <[EMAIL PROTECTED]> wrote: > Hi, > I have a very strange problem (to me anyways). I have the following > subroutine to sort unique a UNIX password file based on UID and > username. But the problem is that some of the users get disappeared > the output pass

Re: perl intersect problem

2008-01-22 Thread Tom Phoenix
On Jan 22, 2008 5:49 PM, Vahid Moghaddasi <[EMAIL PROTECTED]> wrote: > I have the following > subroutine to sort unique a UNIX password file based on UID and > username. Doesn't your password file already have unique usernames and unique UIDs? > But the problem is that some of the users get dis

Re: Please explain @{$y}

2008-01-22 Thread Chas. Owens
On Jan 22, 2008 8:45 PM, bootleg86 bootleg86 <[EMAIL PROTECTED]> wrote: > Hi, > > I came across this construct > foreach $i ( @{$y} ) { > #do something > } > > Is @ referring to some default array that doesn't need to be declared? > > Also it's using the associative version of an array? > I alway

Re: Please explain @{$y}

2008-01-22 Thread John W. Krahn
bootleg86 bootleg86 wrote: Hi, Hello, I came across this construct foreach $i ( @{$y} ) { #do something } Is @ referring to some default array that doesn't need to be declared? Also it's using the associative version of an array? I always thought only hashes were associative. $y is a re

Re: Where is $main defined?

2008-01-22 Thread John W. Krahn
Jenda Krynicky wrote: From: "John W. Krahn" <[EMAIL PROTECTED]> Chas. Owens wrote: On Jan 22, 2008 10:42 AM, Jonathan Mast <[EMAIL PROTECTED]> wrote: I have a perl module that extensively uses a variable named "$main", which is apparently bound to the script that calls the library. I can't fi

Re: Where is $main defined?

2008-01-22 Thread Chas. Owens
On Jan 22, 2008 8:25 PM, Jenda Krynicky <[EMAIL PROTECTED]> wrote: snip > > Or variables like $main'foo. > > I don't think I've ever seen this outside Obfu(scation) or golf. > It's good to know something like that is possible, but please don't > use that. Unless of course you do want to confuse som

perl intersect problem

2008-01-22 Thread Vahid Moghaddasi
Hi, I have a very strange problem (to me anyways). I have the following subroutine to sort unique a UNIX password file based on UID and username. But the problem is that some of the users get disappeared the output password file. I couldn't figure out the pattern of user disappearance but always t

Please explain @{$y}

2008-01-22 Thread bootleg86 bootleg86
Hi, I came across this construct foreach $i ( @{$y} ) { #do something } Is @ referring to some default array that doesn't need to be declared? Also it's using the associative version of an array? I always thought only hashes were associative. Thanks -- To unsubscribe, e-mail: [EMAIL PROTECT

Re: Where is $main defined?

2008-01-22 Thread Jenda Krynicky
From: "John W. Krahn" <[EMAIL PROTECTED]> > Chas. Owens wrote: > > On Jan 22, 2008 10:42 AM, Jonathan Mast <[EMAIL PROTECTED]> wrote: > >> I have a perl module that extensively uses a variable named "$main", which > >> is apparently bound to the script that calls the library. > >> > >> I can't find

Re: losing variable in CGI.pm redirect

2008-01-22 Thread Gunnar Hjalmarsson
Gunnar Hjalmarsson wrote: yitzle wrote: [EMAIL PROTECTED] wrote: I am trying to redirect to a website: print $query->redirect(-location=>test.cgi?ID=$value", - method=>'GET'); Unfortunately the $value never gets passed and I end up with test.cgi? ID= . Why do you only have one double-quote

Re: speeding up a perl script

2008-01-22 Thread Paul Johnson
On Tue, Jan 22, 2008 at 05:52:35PM -0500, Chas. Owens wrote: > On Jan 22, 2008 2:58 PM, lerameur <[EMAIL PROTECTED]> wrote: > > Hello, > > > > I wrote a short perl script (65 lines), simply to count some log file > > time, and take the average. The script takes 4 minutes to run and go > > through a

Re: losing variable in CGI.pm redirect

2008-01-22 Thread Gunnar Hjalmarsson
yitzle wrote: [EMAIL PROTECTED] wrote: I am trying to redirect to a website: print $query->redirect(-location=>test.cgi?ID=$value", - method=>'GET'); Unfortunately the $value never gets passed and I end up with test.cgi? ID= . Why do you only have one double-quote on that line? Are you usin

Re: speeding up a perl script

2008-01-22 Thread John W. Krahn
lerameur wrote: Hello, Hello, I wrote a short perl script (65 lines), simply to count some log file time, and take the average. The script takes 4 minutes to run and go through about 8 millions lines. I would like to know if I can make it run faster. Why?, if I use the command 'wc -l filena

Re: losing variable in CGI.pm redirect

2008-01-22 Thread yitzle
Why do you only have one double-quote on that line? Are you using strict and warnings? print $query->redirect(-location=> "test.cgi?ID=$value", -method=>"GET"); On Jan 22, 2008 4:31 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > Hopefully this appropriate question for this group. I am

Re: speeding up a perl script

2008-01-22 Thread Chas. Owens
On Jan 22, 2008 2:58 PM, lerameur <[EMAIL PROTECTED]> wrote: > Hello, > > I wrote a short perl script (65 lines), simply to count some log file > time, and take the average. The script takes 4 minutes to run and go > through about 8 millions lines. > I would like to know if I can make it run faster

speeding up a perl script

2008-01-22 Thread lerameur
Hello, I wrote a short perl script (65 lines), simply to count some log file time, and take the average. The script takes 4 minutes to run and go through about 8 millions lines. I would like to know if I can make it run faster. Why?, if I use the command 'wc -l filename' , I get the number of li

losing variable in CGI.pm redirect

2008-01-22 Thread [EMAIL PROTECTED]
Hi, Hopefully this appropriate question for this group. I am trying to redirect to a website: print $query->redirect(-location=>test.cgi?ID=$value", - method=>'GET'); Unfortunately the $value never gets passed and I end up with test.cgi? ID= . Thanks, J -- To unsubscribe, e-mail: [EMAIL PRO

Re: Where is $main defined?

2008-01-22 Thread John W. Krahn
Chas. Owens wrote: On Jan 22, 2008 10:42 AM, Jonathan Mast <[EMAIL PROTECTED]> wrote: I have a perl module that extensively uses a variable named "$main", which is apparently bound to the script that calls the library. I can't find where the exact semantics of this automagic variable defined.

Re: Hash of hashes?

2008-01-22 Thread John W. Krahn
Chas. Owens wrote: On Jan 21, 2008 4:30 PM, Kevin Viel <[EMAIL PROTECTED]> wrote: snip You placed another little gem in here for me to digest: $outer{$snp}{$_}++ for $genotype =~ /(.)/g; } I guess when I conceive of that by myself, I should move to the intermediate mailing list :) snip

Re: about the dot

2008-01-22 Thread Bobby
On Tuesday 22 January 2008 13:06:58 Paul Lalli wrote: > On Jan 22, 2:00 am, [EMAIL PROTECTED] (Jeff Pang) wrote: > > I'm a little confused by perl's dot operator.for example, > > > > $ perl -le 'print 3 . 4 ' > > 34 > > $ perl -le 'print 3.4 '   > > 3.4 > > > > these two commands got different resu

Re: about the dot

2008-01-22 Thread Paul Lalli
On Jan 22, 2:00 am, [EMAIL PROTECTED] (Jeff Pang) wrote: > I'm a little confused by perl's dot operator.for example, > > $ perl -le 'print 3 . 4 ' > 34 > $ perl -le 'print 3.4 '   > 3.4 > > these two commands got different results. > > who says Perl interpreter will ignore the blackspace around an

Re: about the dot

2008-01-22 Thread Jenda Krynicky
From: Jeff Pang <[EMAIL PROTECTED]> > I'm a little confused by perl's dot operator.for example, > > $ perl -le 'print 3 . 4 ' > 34 > $ perl -le 'print 3.4 ' > 3.4 > > these two commands got different results. > > who says Perl interpreter will ignore the blackspace around an operator? I > sa

Re: Hash of hashes?

2008-01-22 Thread Chas. Owens
On Jan 21, 2008 4:30 PM, Kevin Viel <[EMAIL PROTECTED]> wrote: snip > You placed another little gem in here for me to digest: > > > $outer{$snp}{$_}++ for $genotype =~ /(.)/g; } > > I guess when I conceive of that by myself, I should move to the intermediate > mailing list :) snip It could a

Re: Where is $main defined?

2008-01-22 Thread Chas. Owens
On Jan 22, 2008 10:42 AM, Jonathan Mast <[EMAIL PROTECTED]> wrote: > I have a perl module that extensively uses a variable named "$main", which > is apparently bound to the script that calls the library. > > I can't find where the exact semantics of this automagic variable defined. snip There is n

Where is $main defined?

2008-01-22 Thread Jonathan Mast
I have a perl module that extensively uses a variable named "$main", which is apparently bound to the script that calls the library. I can't find where the exact semantics of this automagic variable defined. thanks, jhmast

RE: Hash of hashes?

2008-01-22 Thread Kevin Viel
> -Original Message- > From: Chas. Owens [mailto:[EMAIL PROTECTED] > Sent: Monday, January 21, 2008 1:11 PM > To: Kevin Viel > Cc: beginners@perl.org > Subject: Re: Hash of hashes? > #! /usr/bin/perl > > use strict; > use warnings; > > use Data::Dumper; > > #this needs a better more

Re: list or hash of replacement regex

2008-01-22 Thread Rob Dixon
Zhao, Bingfeng wrote: Hi list, I'm in trouble and hope who can work me out. I want to so some replacements, so I want to keep all replacement policies in a hash so that I can use them in a foreach loop, such as: my %policies = ( "abc" => "def", "jfk\s+" => "jfk ", "(\d+)u

Re: list or hash of replacement regex

2008-01-22 Thread John W. Krahn
Zhao, Bingfeng wrote: Hi list, Hello, I'm in trouble and hope who can work me out. I want to so some replacements, so I want to keep all replacement policies in a hash so that I can use them in a foreach loop, such as: my %policies = ( "abc" => "def", "jfk\s+" => "jfk ",

Re: about the dot

2008-01-22 Thread Rob Dixon
Jeff Pang wrote: > I'm a little confused by perl's dot operator.for example, $ perl -le 'print 3 . 4 ' 34 $ perl -le 'print 3.4 ' 3.4 these two commands got different results. who says Perl interpreter will ignore the blackspace around an operator? I saw it doesn't here. Ok you may say 3.4 is

Re: Perl libs polluting root directory

2008-01-22 Thread Tri Trinh
On Jan 19, 3:20 pm, [EMAIL PROTECTED] (Daniel D Jones) wrote: > I'm running Gentoo, which does not yet have version 5.10 in the tree. I > downloaded and installed version 5.10 from source. (I'm not certain that > this is the cause of the issue, but it's the only thing I can think of.) > Now, Perl

RE: list or hash of replacement regex

2008-01-22 Thread Zhao, Bingfeng
Thanks, Jeff. But for qr/(\d+)uu/ and 'uu\1' on '22uu', I got 'uu\1' instead of 'uu22'. -Original Message- From: Jeff Pang [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 22, 2008 5:02 PM To: beginners-list Subject: Re: list or hash of replacement regex -Original Message- >

Re: list or hash of replacement regex

2008-01-22 Thread Jeff Pang
-Original Message- >From: "Zhao, Bingfeng" <[EMAIL PROTECTED]> >Sent: Jan 22, 2008 4:53 PM >To: beginners@perl.org >Subject: list or hash of replacement regex > >But perl complains, so I update it as: >my %policies = ( > qr/abc/ => "def", > qr/jfk\s+/ => "jfk ", > qr/\d+

list or hash of replacement regex

2008-01-22 Thread Zhao, Bingfeng
Hi list, I'm in trouble and hope who can work me out. I want to so some replacements, so I want to keep all replacement policies in a hash so that I can use them in a foreach loop, such as: my %policies = ( "abc" => "def", "jfk\s+" => "jfk ", "(\d+)uu" => "uu\1" #... many p