Re: user id validation

2008-07-01 Thread Richard Lee
Randal L. Schwartz wrote: "Rajnikant" == Rajnikant <[EMAIL PROTECTED]> writes: Rajnikant> Is there any such way to get home directory of user? Is there any such way that this might be, perhaps, oh, a FAQ? Oh, yes, let's see. $ perldoc -q tilde Found in /usr/libdata/pe

user id validation

2008-07-01 Thread Richard Lee
I am just wondering how to validate a user who is using the script?? I wanted to allow only user below to be able to user the script and was thinking about userA(userid: 1077) userB(userid: 1088) userC(userid: 1099) so, inside of script, I would put, unless ( $userid =~ /1077|1088|1099/ ) {

from intermediate perl book on closure and callback

2008-06-18 Thread Richard Lee
trying to understand closure and callback(bit over my head but) while I think i grasp most of the ideas from below program.. I don't think I understand why ( ) is needed in my $sum = $subs{$_}{GETTER}->( ); #!/usr/bin/perl use warnings; use strict; use File::Find; sub create_find_callback

Re: example from 'writing perl modules'... quesiton

2008-06-15 Thread Richard Lee
Rob Dixon wrote: Richard Lee wrote: I was just testing out the code from the book 'writing perl modules for cpan' and I am trying out below module and getting compiled error. I cannot/donot see what is wrong w/ the code. can anyone see? use strict; use warnings; package BO

Re: example from 'writing perl modules'... quesiton

2008-06-15 Thread Richard Lee
Rob Dixon wrote: Richard Lee wrote: I was just testing out the code from the book 'writing perl modules for cpan' and I am trying out below module and getting compiled error. I cannot/donot see what is wrong w/ the code. can anyone see? use strict; use warnings; package BO

example from 'writing perl modules'... quesiton

2008-06-15 Thread Richard Lee
I was just testing out the code from the book 'writing perl modules for cpan' and I am trying out below module and getting compiled error. I cannot/donot see what is wrong w/ the code. can anyone see? use strict; use warnings; package BOA::Logger2; use Carp qw(croak); use IO::File; #construc

Re: module question

2008-06-14 Thread Richard Lee
Jeff Peng wrote: On Sat, Jun 14, 2008 at 11:21 PM, Richard Lee <[EMAIL PROTECTED]> wrote: trying to follow some modules examples.. but have a quick quesiton Below pm works if I don't use strict and use @ISA and @EXPORT.. but not when I use strict and my @ISA and

module question

2008-06-14 Thread Richard Lee
trying to follow some modules examples.. but have a quick quesiton Below pm works if I don't use strict and use @ISA and @EXPORT.. but not when I use strict and my @ISA and my @EXPORT am i not suppose to use strict for modules?? --- only works..

Re: creating blackjack perl program (starts with pseudocode first)

2008-06-11 Thread Richard Lee
Richard Lee wrote: Rob Dixon wrote: I suggest you start by describing a very simple game that's not blackjack. One player gets dealt cards until he hits 21 or more. 21 is a win, more is a loss. Then add a dealer's hand. Then add face down cards Then add betting Then add, erm,

Re: creating blackjack perl program (starts with pseudocode first)

2008-06-11 Thread Richard Lee
Rob Dixon wrote: I suggest you start by describing a very simple game that's not blackjack. One player gets dealt cards until he hits 21 or more. 21 is a win, more is a loss. Then add a dealer's hand. Then add face down cards Then add betting Then add, erm, insurance? Finish with the green

creating blackjack perl program (starts with pseudocode first)

2008-06-11 Thread Richard Lee
hi guys, Just for learning purpose and also for my enjoyment, I wanted to combine my fav game(blackjack) and my love for perl. I wanted to re-invent the wheel to help me and train myself to think like programmar First I wanted to create a pseudocode code since I wanted to use it late

Re: pie multiline replace

2008-06-06 Thread Richard Lee
Gunnar Hjalmarsson wrote: close $out; I was just going over this... but shouldn't it be print $out "# Add this line to the top\n"; # ??? or did I miss something? I think you are right. I'd suggest that you send a note to Brian d'Foy ([EMAIL PROTECTED]), who is maintaining the FAQ.

Re: any ruby programmers who are perl users?

2008-06-06 Thread Richard Lee
zentara wrote: On Thu, 05 Jun 2008 21:16:42 -0400, [EMAIL PROTECTED] (Richard Lee) wrote: Most likely just out of curiosity factor, I picked up a book "Learning to program " the facets of ruby series.. See what some experienced Perl programmers say about Ruby http://per

Re: pie multiline replace

2008-06-05 Thread Richard Lee
Gunnar Hjalmarsson wrote: bill lam wrote: Sorry this must be a faq but I cannot find any answer in google. Google?? If you think it's a FAQ, you'd better check the Perl FAQ. perldoc -q "insert a line" Within that basic form, add the parts that you need to insert, change, or delete lines

any ruby programmers who are perl users?

2008-06-05 Thread Richard Lee
Most likely just out of curiosity factor, I picked up a book "Learning to program " the facets of ruby series.. While very simple in nature, book try to teach computer programming concept while giving some ruby lesson.. Even though I am still a beginner for perl, I just wanted to pick up 2nd l

Re: in the elemetns of programming perl , I need help with 2 lines that I don't understand

2008-06-02 Thread Richard Lee
Rob Dixon wrote: qr// isn't often necessary, as they are usually defined, compiled and used at the same point, like constants. However, if you have a regex that you need to use in several places in your code then it can be useful to declare it separately, like my $bracketed = qr/^\{.*\}$/;

Re: in the elemetns of programming perl , I need help with 2 lines that I don't understand

2008-06-02 Thread Richard Lee
Chas. Owens wrote: w? And why? snip how: my $pattern = '.*(?:' . join('|', map quotemeta, @ARGV) . ')'; $pattern = qr/$pattern/; why: To compile the regex. In the original program, the regexes use the o modifier to promise that $pattern won't change so the optimizer can compile the reg

Re: in the elemetns of programming perl , I need help with 2 lines that I don't understand

2008-06-01 Thread Richard Lee
Rob Dixon wrote: It's always confusing when a program written in one language (here, Perl) creates a program in another (this script is building regular expressions). Look at the strings those lines are generating. use strict; use warnings; local @ARGV = qw/A B C/; my $or_pattern = '.*(?:' .

Re: in the elemetns of programming perl , I need help with 2 lines that I don't understand

2008-06-01 Thread Richard Lee
Dr.Ruud wrote: Richard Lee schreef: $pattern = '.*(?:' . join('|', @ARGV) . ')'; Safer: $pattern = '.*(?:' . join('|', map quotemeta, @ARGV) . ')'; And I would do a qr() on top of that. } else { $patter

in the elemetns of programming perl , I need help with 2 lines that I don't understand

2008-06-01 Thread Richard Lee
In the book "elements of programming perl", below program is presented. I don't really understand these 2 lines. can someone break it down for me please? $pattern = '.*(?:' . join('|', @ARGV) . ')'; $pattern = join('', map{"(?=.*$_)"} @ARGV); #!/usr/bin/perl use strict; use warnings; my

WWW::Mechanize question

2008-05-31 Thread Richard Lee
what is wrong w/ below? I would think this would work but this is spitting out use strict; use warnings; use WWW::Mechanize; my $mech = WWW::Mechanize->new(); my $url = 'http://10.212.100.1'; #$mech->credentials('user1', 'passwd1'); my $page = $mech->get( $url ); print "$page\n"; when I run

Re: how does file gets send to remote machine using perl

2008-05-30 Thread Richard Lee
Chas. Owens wrote: On Thu, May 29, 2008 at 7:46 PM, Richard Lee <[EMAIL PROTECTED]> wrote: Hi, Someone wrote a perl script which manipulate a file and sent to number of remote system. I ported that exact script to my local machine but I don't see anything going out. Peeking into

how does file gets send to remote machine using perl

2008-05-29 Thread Richard Lee
Hi, Someone wrote a perl script which manipulate a file and sent to number of remote system. I ported that exact script to my local machine but I don't see anything going out. Peeking into the script, I see no special module being used and no ftp/sftp/scp or anything like that being used. Do

Re: regex question matching dates

2008-05-29 Thread Richard Lee
John W. Krahn wrote: } elsif ( $ARGV[0] =~ m/\b2008(0[1-9]|1[12])(0[1-9]|1[0-9]|2[0-9]|3[01])([01][0-9]|2[0-3])\b/ ) { ^ So you don't want to test for October? John fixed now. thanks!! } elsif ( $ARGV[0] =~ m/\b2008(0[1-9]|1[012])(0[1-9]|1[0-9]|2[0-9]|3[01])([01][

Re: regex question matching dates

2008-05-28 Thread Richard Lee
John W. Krahn wrote: Richard Lee wrote: given then ARGV[0] is 2008052803, why woulnd't below regex match them?? 2008052803 is a ten digit number. } elsif ( $ARGV[0] =~ m/\b2008[01][1-31]([01][0-9]|2[0-3])\b/ ) { Your pattern matches eight digits with a \b word boundary at each end

regex question matching dates

2008-05-28 Thread Richard Lee
given then ARGV[0] is 2008052803, why woulnd't below regex match them?? } elsif ( $ARGV[0] =~ m/\b2008[01][1-31]([01][0-9]|2[0-3])\b/ ) { @array = qx#ls -tr $directory/$ARGV[0]*#; #2008052803 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED

Re: assign default value to variables I assign from split

2008-05-28 Thread Richard Lee
John W. Krahn wrote: SYNOPSIS gzip [ -acdfhlLnNrtvV19 ] [-S suffix] [ name ... ] gunzip [ -acfhlLnNrtvV ] [-S suffix] [ name ... ] zcat [ -fhLV ] [ name ... ] Note that the -d switch applies to gzip only. zcat by definition is *supposed* to decompress files. (Why wo

Re: assign default value to variables I assign from split

2008-05-28 Thread Richard Lee
John W. Krahn wrote: open FILE, "ls -tr | zcat -d $directory/$file |", or die qq/you My version of zcat does not have a -d switch, what does it do on your system? It appears that "ls -tr | " in front of zcat is superfluous? What do you think it will do there? Just to follow up

Re: How to measure the efficiency, load & performance of a script?

2008-05-20 Thread Richard Lee
timbo wrote: Hi all, I was just wondering if any general tools / modules exist to help measure the efficiency of any code. I know that the Learning Perl books cover the theory but was wanting to know if there were good measuring methods available. Its pretty easy to figure out the time a script

Re: question regarding how to launch perl script on remote machine

2008-05-19 Thread Richard Lee
Matthew Whipple wrote: That would depend upon which side that command was executed. Keep in mind that he had mentioned a script that would iniate the SSH connection from the Solaris computer and could retrieve data from that computer which could then be passed over the connection. I unfortuna

question regarding how to launch perl script on remote machine

2008-05-18 Thread Richard Lee
so just to put it out there for my ideas to run more perl scripts at work using modules that I cannot install(whether due to lack of knoweldge or just don't have the right).. at work, we have a solaris based unix server(lets say serverK) which is being served as central logon for all the daily

Re: perl and web

2008-05-18 Thread Richard Lee
yitzle wrote: See: http://search.cpan.org/~petdance/WWW-Mechanize-1.34/lib/WWW/Mechanize.pm#$mech-%3Ecredentials(_$username,_$password_) $mech->credentials( $username, $password ) Provide credentials to be used for HTTP Basic authentication for all sites and realms until further notice. The fo

Re: perl and web

2008-05-18 Thread Richard Lee
Rob Coops wrote: This has been asked at least as often as it has been anwsered and so far the most flexible solution I have found, not the simplest though. WWW::Mechanize There are a lot of others out there and a lo

Re: learning perl 3rd vs 4th

2008-05-17 Thread Richard Lee
Rob Dixon wrote: Richard Lee wrote: Currently I own a 'learning perl' 3rd edition and I noticed that 5th version is coming out in june. What I didn't realize was that learning perl 4th edition's been out since 2005. I was going to order 5th version in june but does

learning perl 3rd vs 4th

2008-05-17 Thread Richard Lee
Currently I own a 'learning perl' 3rd edition and I noticed that 5th version is coming out in june. What I didn't realize was that learning perl 4th edition's been out since 2005. I was going to order 5th version in june but does anyone in here know the different between 3rd and 4th version?

Re: website

2008-05-15 Thread Richard Lee
Jerald Sheets wrote: Here's one that's still in there: http://web.archive.org/web/20021004030027/www.raycosoft.com/rayco/support/perl_tutor.html Get it while it's good. Also, check out PerlMonks & The OReilley Perl site. Also, PlanetPerl is very helpful from time to time. --jms On Ma

Re: assign default value to variables I assign from split

2008-05-14 Thread Richard Lee
John W. Krahn wrote: Richard Lee wrote: Dr.Ruud wrote: But better stop guessing and let Richard answer. yes, variables are particular names and later I wanted to refer back by variable names. However, for now I have done this so far so I just added as array instead of breaking out by

Re: assign default value to variables I assign from split

2008-05-14 Thread Richard Lee
Dr.Ruud wrote: "Jenda Krynicky" schreef: Dr.Ruud: Richard Lee: [$file1,$file2,$file3,$file4,$file5,$file6,$file10,$file25] I didn't want to put them in array since I need to use individual named variable later And why is that? Maybe beca

faster ways than perl?

2008-05-14 Thread Richard Lee
I am running this command on over 2 gigs worth of lines which one should be faster? cut -d'|' -f21 * | sort | uniq -c | sort perl -F"\|" -lane 'print $F[21]' * | sort | uniq -c | sort or is there faster ways to do this on perl? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additiona

perl and web

2008-05-14 Thread Richard Lee
Hi guys again! I am sure this questions been around for while but I am not sure where to begin. I am trying to grep a html page given a URL and then extract some information from the source code. So something like open FH, "www.example.com/index.html | " , or die "no way : $!\n"; @array = ;

Re: want to assign default value to variable I assign from split but want to know optimal way to get this done: please help!

2008-05-13 Thread Richard Lee
Rob Dixon wrote: Richard Lee wrote: while () { my($file1,$file2,$file3,$file4,$file5,$file6,$file10,$file25,$file27) = (split( /\|/, $_))[3,4,6,7,12,40,41,42,43,46,56,64] } while doing above, what is the easiest way to make sure all the variable that's being given a val

want to assign default value to variable I assign from split but want to know optimal way to get this done: please help!

2008-05-12 Thread Richard Lee
while () { my($file1,$file2,$file3,$file4,$file5,$file6,$file10,$file25,$file27) = (split( /\|/, $_))[3,4,6,7,12,40,41,42,43,46,56,64] } while doing above, what is the easiest way to make sure all the variable that's being given a value is true and if not assign something default

Re: $^I

2008-05-11 Thread Richard Lee
Chas. Owens wrote: On May 11, 2008, at 18:04, Richard Lee wrote: I just looked it up on perldoc perlvar, but I am still not sure what it does. $^I The current value of the inplace-edit extension. Use "undef" to disable inplace editing. (Mnemonic: value of -i s

$^I

2008-05-11 Thread Richard Lee
I just looked it up on perldoc perlvar, but I am still not sure what it does. $^I The current value of the inplace-edit extension. Use "undef" to disable inplace editing. (Mnemonic: value of -i switch.) I was reading perl cookbook and saw this example, and was wondering

Re: perl-support for vim help needed

2008-05-10 Thread Richard Lee
Chas. Owens wrote: On Sat, May 10, 2008 at 1:42 AM, Richard Lee <[EMAIL PROTECTED]> wrote: does anyone use perl-support for vim here? I installed it but having trouble bringing up the menus.. does anyone uses this? and know how to bring up the menu? If the root menu 'Perl'

Re: Please help critcize and shorten my sub code

2008-05-10 Thread Richard Lee
Jenda Krynicky wrote: From: Richard Lee <[EMAIL PROTECTED]> Jenda Krynicky wrote: You may do something like this: for my $wanted ( [outsideroute_group_m => route_name => \$routename, route_group_id => \$routegroupid], [outsideroute_trunk_m =&

Re: Please help critcize and shorten my sub code

2008-05-10 Thread Richard Lee
Jenda Krynicky wrote: From: Richard Lee <[EMAIL PROTECTED]> I dont know how to go through the array over and over again pending on my previous search so I ended up writing it like below which works.. but looks really really inefficient.. sub dd_fact { my $rou

Please help critcize and shorten my sub code

2008-05-10 Thread Richard Lee
I dont know how to go through the array over and over again pending on my previous search so I ended up writing it like below which works.. but looks really really inefficient.. sub dd_fact { my $routename = shift; my $routegroupid; my $trunkgroupid; my $carriername; my $ca

split slice question

2008-05-10 Thread Richard Lee
I use this before (split slice ) but it's working bit funny now.. can someone tell me why?? it looks like it's splitting on '' instead of /|/ as I have specified below... ?? use strict; use warnings; my $array = q/hi|how|are|you|fine/; my ($moe,$hae,$now) = (split(/|/,$array))[0,1,2]; prin

perl-support for vim help needed

2008-05-09 Thread Richard Lee
does anyone use perl-support for vim here? I installed it but having trouble bringing up the menus.. does anyone uses this? and know how to bring up the menu? If the root menu 'Perl' is not visible call it with the item "Load Perl Support" from the standard Tools-menu. <-- where is this sta

Re: one liner for for and if

2008-05-08 Thread Richard Lee
Rob Dixon wrote: Richard Lee wrote: #!/usr/bin/perl use warnings; use strict; my @array = qw/one two three four/; print "$_\n" for @array last if "$_" eq q/three/; [EMAIL PROTECTED] tmp]# ./!$ ././././testthis2.pl syntax error at ././././testthis2.pl line

one liner for for and if

2008-05-08 Thread Richard Lee
#!/usr/bin/perl use warnings; use strict; my @array = qw/one two three four/; print "$_\n" for @array last if "$_" eq q/three/; [EMAIL PROTECTED] tmp]# ./!$ ././././testthis2.pl syntax error at ././././testthis2.pl line 8, near "@array last " Execution of ././././testthis2.pl aborted due to c

Re: how to shorten this code ? x occur how many times in variable

2008-05-07 Thread Richard Lee
John W. Krahn wrote: Richard Lee wrote: Rob Dixon wrote: returns the number of colons found but leaves them untouched. Similarly $str =? tr/\t /_/; this is great!! use warnings; use strict; my $str = 'ab:cd:ef:g:hi::now;'; print $str =~ tr/:// . "\n"; print $st

Re: how to shorten this code ? x occur how many times in variable

2008-05-07 Thread Richard Lee
Rob Dixon wrote: Richard Lee wrote: John W. Krahn wrote: Richard Lee wrote: Can you please tell me how to shorten this? my @an = split(//); my @num = grep { $_ eq ':' } @an ; I was trying to see how many : occur in variable but didn't know how to do it f

Re: how to shorten this code ? x occur how many times in variable

2008-05-07 Thread Richard Lee
John W. Krahn wrote: Richard Lee wrote: Can you please tell me how to shorten this? my @an = split(//); my @num = grep { $_ eq ':' } @an ; I was trying to see how many : occur in variable but didn't know how to do it fast so i did it like above... I would like to see as man

how to shorten this code ? x occur how many times in variable

2008-05-06 Thread Richard Lee
Can you please tell me how to shorten this? my @an = split(//); my @num = grep { $_ eq ':' } @an ; I was trying to see how many : occur in variable but didn't know how to do it fast so i did it like above... I would like to see as many way different ways to get this done if possible thank yo

Re: how to simplify this script

2008-05-06 Thread Richard Lee
Gunnar Hjalmarsson wrote: Richard Lee wrote: Gunnar Hjalmarsson wrote: Richard Lee wrote: code of Gunnar's my $numbers_wanted = 2; my ( @datawanted, @numbers ); LOOP: foreach ( @datas ) { my @test = split; foreach my $num ( @numbers ) {

Re: how to simplify this script

2008-05-05 Thread Richard Lee
Gunnar Hjalmarsson wrote: Richard Lee wrote: " It should include '1 2 3' because '1 2 3', '1 2 4', '1 2 7', '1 2 8', '1 2 9' = '1 2'(the common number from the list) + anynumber. " as any of them contains 1 and 2

Re: how to simplify this script

2008-05-04 Thread Richard Lee
[EMAIL PROTECTED] wrote: > From: "Richard Lee" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Cc: > Sent: Sunday, May 04, 2008 3:17 AM > Subject: Re: how to simplify this script > >> I don't have the solution yet but shouldn't the answer be

Re: Perl Modules

2008-05-04 Thread Richard Lee
Richard Lee wrote: Richard Lee wrote: Chas. Owens wrote: On Apr 16, 2008, at 13:33, Monty wrote: Hope this is the right forum for this. I recently downloaded Curses-1.23.tar from CPAN for installation on to my Solaris 8 system. I installed the module in the same area as all my other perl

Re: Perl Modules

2008-05-04 Thread Richard Lee
Richard Lee wrote: Chas. Owens wrote: On Apr 16, 2008, at 13:33, Monty wrote: Hope this is the right forum for this. I recently downloaded Curses-1.23.tar from CPAN for installation on to my Solaris 8 system. I installed the module in the same area as all my other perl modules: /usr/local

Re: Perl Modules

2008-05-04 Thread Richard Lee
Chas. Owens wrote: On Apr 16, 2008, at 13:33, Monty wrote: Hope this is the right forum for this. I recently downloaded Curses-1.23.tar from CPAN for installation on to my Solaris 8 system. I installed the module in the same area as all my other perl modules: /usr/local/lib/perl5/5.8.5, but I

Re: how to simplify this script

2008-05-03 Thread Richard Lee
[EMAIL PROTECTED] wrote: > Hi, > In the script below, I have an array @datas with its elements consisting of > numbers like this :- > > my @datas = ( > '1 2 3', '1 2 4', '1 2 7', '1 2 8', '1 2 9', '1 6 7', > '1 7 12', '2 6 7', '4 5 10', '4 5 15' > ); > > Out of the above list, I wish to

Re: how to simplify this script

2008-05-03 Thread Richard Lee
[EMAIL PROTECTED] wrote: > Hi, > In the script below, I have an array @datas with its elements consisting of > numbers like this :- > > my @datas = ( > '1 2 3', '1 2 4', '1 2 7', '1 2 8', '1 2 9', '1 6 7', > '1 7 12', '2 6 7', '4 5 10', '4 5 15' > ); > > Out of the above list, I wish to

Re: IDE for Perl in Linux

2008-05-02 Thread Richard Lee
eko hermiyanto wrote: GNU Emacs my friend. GNU Emacs. On Sat, May 3, 2008 at 6:22 AM, J. D. <[EMAIL PROTECTED]> wrote: Gvim or vim have an add on called perl-support that provides some very handy IDE-like features. Best regards, J. D. On 5/2/08, Dr.Ruud <[EMAIL PROTECTED] <[EMAIL PROTECT

Re: another help on input record separator clarity please

2008-05-02 Thread Richard Lee
Chas. Owens wrote: On Fri, May 2, 2008 at 5:08 PM, Joshua Hoblitt <[EMAIL PROTECTED]> wrote: snip They are probably undefinately because the record seperator is being set lexically inside of the loop (and thus won't apply to the outer while). Please consider this code: local $/ = "\

Re: another help on input record separator clarity please

2008-05-02 Thread Richard Lee
Chas. Owens wrote: On Fri, May 2, 2008 at 5:55 PM, Richard Lee <[EMAIL PROTECTED]> wrote: snip while () { local $/ = "\n\n"; snip } snip You want $/ to have an effect on , but it is localized to inside of the loop. You need to say { local $/ = &

another help on input record separator clarity please

2008-05-02 Thread Richard Lee
Please help me with this another misunderstanding of my perl. My plan is to make input record separator to "\n\n" so that file records are separated by blank space.. and then collect information and push them into array by joining. But when I run this, it says uninitilized values... I am doin

Re: File and perl

2008-05-01 Thread Richard Lee
Chas. Owens wrote: On Thu, May 1, 2008 at 8:45 PM, Richard Lee <[EMAIL PROTECTED]> wrote: snip ls -ltr | tail -100 | cut -d' ' -f13 snip Let's pick this apart, shall we? ls -tr gets all of the (non-hidden) files in the current directory reverse sorted by time

File and perl

2008-05-01 Thread Richard Lee
Hi guys, I have been running below to gather into a txt file before running perl program to analyze the data but I want to transform into 100% perl. so, right now my little line says ls -ltr | tail -100 | cut -d' ' -f13 | while read n ; do zcat -d $n | grep -i 'server|client' | /usr/bin/progr

Re: perl -MCPAN -e shell failed

2008-04-29 Thread Richard Lee
Rob Dixon wrote: Richard Lee wrote: after freshelly installing fedora 9(which is preview version) and which has perl 5.10 fails command line perl module install. Granted that it means I don't have cpan.pm module, how come it didn't come w/ it by default or did I do something wro

perl -MCPAN -e shell failed

2008-04-28 Thread Richard Lee
after freshelly installing fedora 9(which is preview version) and which has perl 5.10 fails command line perl module install. Granted that it means I don't have cpan.pm module, how come it didn't come w/ it by default or did I do something wrong? also, searching for CPAN.pm on cpan.org comes up

Perl Sockets Communications

2008-04-28 Thread Richard Luckhurst
= \&Reaper; } #--- sub exWriteSpecialCases { my ($sock, $db_handle, $records_ptr, $debug) = @_; my @records = @$records_ptr; my $file= lc (shift (@records)); my $key = shift (@records);

Re: perl head and tail command ?

2008-04-28 Thread Richard Lee
Rob Dixon wrote: Richard Lee wrote: I would imagine linux's head command can be replaced w/ chop I asked this because I have a filehandle which was, open $source, '/tmp/server.txt' ( and no doing head -1 /tmp/server.txt is not an option since I need to go through some othe

perl head and tail command ?

2008-04-28 Thread Richard Lee
I would imagine linux's head command can be replaced w/ chop I asked this because I have a filehandle which was, open $source, '/tmp/server.txt' ( and no doing head -1 /tmp/server.txt is not an option since I need to go through some other stuff before i need to issue below command ) and I wa

Re: sql and perl

2008-04-28 Thread Richard Lee
Dr.Ruud wrote: Richard Lee schreef: Your posting is a reply to a posting that it has nothing to do with. Next time just start fresh. I want to start learning about sql and how it interacts w/ perl. My rough idea is to install mysql server and read some books to start playing w/ it along

Re: simple question

2008-04-27 Thread Richard Lee
Alex Goor wrote: i have a data set of stock orders and i want to count the number of unique stock symbols in the set. i have turned the data set into an array and based on the message spec, i can identify the stock symbols. but i don't know how to make sure i'm only counting unique ones. i

Re: sql and perl

2008-04-27 Thread Richard Lee
= $sth2->fetchrow_array; You will find many ways of using DBI from the POD doc. HTH. Octavian - Original Message - From: "Richard Lee" <[EMAIL PROTECTED]> Cc: Sent: Sunday, April 27, 2008 6:24 AM Subject: sql and perl Hello guys, I want to start learning about sql and how

Re: sql and perl

2008-04-26 Thread Richard Lee
book you mentioned is right for your purpose I think. On Sun, Apr 27, 2008 at 11:24 AM, Richard Lee <[EMAIL PROTECTED]> wrote: Hello guys, I want to start learning about sql and how it interacts w/ perl. My rough idea is to install mysql server and read some books to start playing

sql and perl

2008-04-26 Thread Richard Lee
Hello guys, I want to start learning about sql and how it interacts w/ perl. My rough idea is to install mysql server and read some books to start playing w/ it along w/ perl. Any advice? For now, I just plan to go through the book 'mysql and perl for the web' If someone can post some ex

Re: going through array of hash, it only goes through limited amount of keys while doing for each command

2008-04-23 Thread Richard Lee
John W. Krahn wrote: Richard Lee wrote: something is wrong with this.. say %yahoo's key contains the variable , X I wanted to go through the @array which has array of hashes... to see if one of the value is equal to X and if it is, wanted to assign the key of the @array to $e

Re: going through array of hash, it only goes through limited amount of keys while doing for each command

2008-04-23 Thread Richard Lee
John W. Krahn wrote: Richard Lee wrote: something is wrong with this.. say %yahoo's key contains the variable , X I wanted to go through the @array which has array of hashes... to see if one of the value is equal to X and if it is, wanted to assign the key of the @array to $e

Re: going through array of hash, it only goes through limited amount of keys while doing for each command

2008-04-23 Thread Richard Lee
John W. Krahn wrote: Richard Lee wrote: something is wrong with this.. say %yahoo's key contains the variable , X I wanted to go through the @array which has array of hashes... to see if one of the value is equal to X and if it is, wanted to assign the key of the @array to $e

Re: going through array of hash, it only goes through limited amount of keys while doing for each command

2008-04-23 Thread Richard Lee
John W. Krahn wrote: Richard Lee wrote: something is wrong with this.. say %yahoo's key contains the variable , X I wanted to go through the @array which has array of hashes... to see if one of the value is equal to X and if it is, wanted to assign the key of the @array to $e

going through array of hash, it only goes through limited amount of keys while doing for each command

2008-04-23 Thread Richard Lee
something is wrong with this.. say %yahoo's key contains the variable , X I wanted to go through the @array which has array of hashes... to see if one of the value is equal to X and if it is, wanted to assign the key of the @array to $ex_var.. Tracing the program, it only goes through 6 line

Re: opening a big file

2008-04-21 Thread Richard Lee
Gunnar Hjalmarsson wrote: Richard Lee wrote: Gunnar Hjalmarsson wrote: Richard Lee wrote: Unfortunately however, the system I am on, I cannot install any modules other than standard modules that already come with the perl. Assuming you have at least FTP access, you are wrong. Which are the

Re: opening a big file

2008-04-21 Thread Richard Lee
Gunnar Hjalmarsson wrote: Richard Lee wrote: Unfortunately however, the system I am on, I cannot install any modules other than standard modules that already come with the perl. Assuming you have at least FTP access, you are wrong. Which are the restrictions? I guess even that, I should

Re: opening a big file

2008-04-21 Thread Richard Lee
and so on. The file is not loaded into memory, so this will work even for gigantic files. Changes to the array are reflected in the file immediately. Richard Lee wrote: I am trying to open a big file and go through line by line while limiting the resource on the system. What is th

Re: opening a big file

2008-04-20 Thread Richard Lee
Mr. Shawn H. Corey wrote: On Sun, 2008-04-20 at 17:02 -0400, Richard Lee wrote: Chas. Owens wrote: On Sun, Apr 20, 2008 at 1:49 PM, Richard Lee <[EMAIL PROTECTED]> wrote: snip can this be optimized in anyway? open (my $source, '-|', "tail -10 /ser

Re: Simple perl array question

2008-04-20 Thread Richard Lee
[EMAIL PROTECTED] wrote: Well simple if you are not learning Perl. You guessed it, I am a newbie. My question is if I have an array like this, actually it is my whole program. my @testarray=( [5, [1,3,18,21]], [16, [1,2,3]], [21, [1]]); print [EMAIL PROTECTED]; print [EMAIL PROTECTED]; print [E

Re: opening a big file

2008-04-20 Thread Richard Lee
Chas. Owens wrote: On Sun, Apr 20, 2008 at 1:49 PM, Richard Lee <[EMAIL PROTECTED]> wrote: snip can this be optimized in anyway? open (my $source, '-|', "tail -10 /server/server.log") is this the best way to get large portion(well file itself is over 20 ti

Re: opening a big file

2008-04-20 Thread Richard Lee
Mr. Shawn H. Corey wrote: On Sun, 2008-04-06 at 22:36 -0400, Richard Lee wrote: I am trying to open a big file and go through line by line while limiting the resource on the system. What is the best way to do it? Does below read the entire file and store them in memory(not good if that&#

Re: regex variable matching when it's more than variable

2008-04-20 Thread Richard Lee
Rob Dixon wrote: Richard Lee wrote: say I have my $var1 = 'abcdefg'; my @array = ( 'abcdefg_3432', 'defg_333', 'abcdefg_' , 'abcdefg_a' ); Let's say I want to go through the array to see if $var1 exists and also to see if it followed

regex variable matching when it's more than variable

2008-04-20 Thread Richard Lee
say I have my $var1 = 'abcdefg'; my @array = ( 'abcdefg_3432', 'defg_333', 'abcdefg_' , 'abcdefg_a' ); Let's say I want to go through the array to see if $var1 exists and also to see if it followed by _ and then 4 digits (only first one should quailfy , abcdefg_3432 ) I tried, for (@array)

Re: question on reference

2008-04-19 Thread Richard Lee
John W. Krahn wrote: Richard Lee wrote: Chas. Owens wrote: They do similar, but different, things. The \ operator takes a reference to a variable and [] operator creates an anonymous array. You can build [] from \ by using a temporary array that goes out of scope. my $linked = [EMAIL

Re: question on reference

2008-04-19 Thread Richard Lee
Chas. Owens wrote: On Apr 19, 2008, at 12:39, Richard Lee wrote: what is the difference?? I thought doing [ ] and \ would do the samething snip They do similar, but different, things. The \ operator takes a reference to a variable and [] operator creates an anonymous array. You can

Re: question on reference

2008-04-19 Thread Richard Lee
Chas. Owens wrote: On Apr 19, 2008, at 12:39, Richard Lee wrote: what is the difference?? I thought doing [ ] and \ would do the samething snip They do similar, but different, things. The \ operator takes a reference to a variable and [] operator creates an anonymous array. You can

question on reference

2008-04-19 Thread Richard Lee
what is the difference?? I thought doing [ ] and \ would do the samething #!/usr/bin/perl -w use strict; use Data::Dumper; my %something = ( a => 1, b => 2, c => 3, ); my %something2 = ( a => 1, b => 2, ); sub process_it { my $some

Re: trying to use IO::Handle

2008-04-14 Thread Richard Lee
Chas. Owens wrote: On Mon, Apr 14, 2008 at 12:50 AM, Richard Lee <[EMAIL PROTECTED]> wrote: snip my $start = qr/@{[ POSIX::strftime( '%b %e %H:', localtime time - ONE_HOUR ) ]}/; snip I will have to try out your POSIX solution as I have particular in adding

Re: trying to use IO::Handle

2008-04-13 Thread Richard Lee
John W. Krahn wrote: Richard Lee wrote: John W. Krahn wrote: Richard Lee wrote: John W. Krahn wrote: Richard Lee wrote: John W. Krahn wrote: You are not returning the contents of @bad and you are not passing in the name of the file to open so I assume that this is in a subroutine

<    1   2   3   4   5   6   >