Re: variable will not stay shared

2008-04-10 Thread John W. Krahn
[EMAIL PROTECTED] wrote: Hi Members, Hello, 2)How do I shorten/improve this script. You could try it like this: # start of script # use strict; use warnings; use List::Util qw/ shuffle /; my %config = ( number_of_games=> 5_000, capital

Re: Please let me know where can I find practice exercises

2008-04-10 Thread J. Peng
Learning Perl has exercises after each charpter. On 4/10/08, hemanth <[EMAIL PROTECTED]> wrote: > Hi, > > I am currently learning perl programming. Please help me by giving > some practice exercises or direct me to the site where i can find > them. > > Thanks in Advance! > > Hemanth > > > -- > To

Re: not grep

2008-04-10 Thread Rob Dixon
Johnson, Reginald (GTI) wrote: > Thanks for the assistance. This is what I ended up doing. The hash is > much faster and I am getting what I require in my two output files. My > mhs file has over 26 columns and is over 27,000 lines. > > #!/usr/bin/perl Always use strict; use warnings; and a

Re: how to globalize a lexical variable inside a sub routine

2008-04-10 Thread John W. Krahn
[EMAIL PROTECTED] wrote: Thanks Jenda, Chas.Owens and fellow members. What do you mean by "globalise"? Jenda Looking at the script below, in diagram 1, $capital will not be incremented unless I write it as in diagram 2. Just because I do not want $capital to be reset on each foreach loop, I

Re: Debugger in PErl

2008-04-10 Thread Jenda Krynicky
From: jeevs <[EMAIL PROTECTED]> > Is there a good debugger for perl. I have an application running on > Ubuntu , with apache and mod perl along with mysql. and we are into > reverse engineering the product. And need to debug the code. Is there > any debugger for perl other than th

Re: variable will not stay shared

2008-04-10 Thread Jenda Krynicky
From: <[EMAIL PROTECTED]> > Hi Members, > 1)The script below produce the following warnings:- "variable > $betting_system will not stay shared at roulette.pl line 61." >What is the problem and how do I rectify this problem. Don't write a named subroutine within another named subrouti

Re: how to globalize a lexical variable inside a sub routine

2008-04-10 Thread Jenda Krynicky
Something like ... { my $cnt; sub inc { return ++$cnt; } } print inc(),"\n"; print inc(),"\n"; print inc(),"\n"; Jenda = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and c

variable will not stay shared

2008-04-10 Thread itshardtogetone
Hi Members, 1)The script below produce the following warnings:- "variable $betting_system will not stay shared at roulette.pl line 61." What is the problem and how do I rectify this problem. 2)How do I shorten/improve this script. Thanks # start of script #

Re: how to globalize a lexical variable inside a sub routine

2008-04-10 Thread itshardtogetone
Thanks Jenda, Chas.Owens and fellow members. What do you mean by "globalise"? Jenda Looking at the script below, in diagram 1, $capital will not be incremented unless I write it as in diagram 2. Just because I do not want $capital to be reset on each foreach loop, I then have to declare $cap

Re: Best way to grab lines n thru x of a file

2008-04-10 Thread yitzle
On Thu, Apr 10, 2008 at 4:35 PM, Jonathan Mast <[EMAIL PROTECTED]> wrote: > Thanks for all the input. > > The head / tail solution would work, but isn't very scalable. I did > something similar on another file of comparable size and it took a long time > to complete. > > The line numbers are 4

RE: not grep

2008-04-10 Thread Johnson, Reginald (GTI)
Thanks for the assistance. This is what I ended up doing. The hash is much faster and I am getting what I require in my two output files. My mhs file has over 26 columns and is over 27,000 lines. #!/usr/bin/perl $file="/adsm/CRONJOBS/MHS/nodes_cleanedup"; $mhs="/adsm/CRONJOBS/MH

Re: Best way to grab lines n thru x of a file

2008-04-10 Thread Jonathan Mast
Thanks for all the input. The head / tail solution would work, but isn't very scalable. I did something similar on another file of comparable size and it took a long time to complete. The line numbers are 4million to 4million + some odd hundred thousand, just to give an idea of the size. The se

Re: Best way to grab lines n thru x of a file

2008-04-10 Thread yitzle
or use sed! To print lines 5 through 10: sed -ne '5,10p' -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Trying to splice....

2008-04-10 Thread [EMAIL PROTECTED]
On Apr 10, 9:03 am, [EMAIL PROTECTED] (Gunnar Hjalmarsson) wrote: > [EMAIL PROTECTED] wrote: > > [EMAIL PROTECTED] into the middle of @players without removing any elements > > from @players. > > > so i've done the following... > > > #!/usr/bin/perl -w > > > # extracting elements using splice > > >

RE: Sometimes Net::SSH2 can't read() from channel?

2008-04-10 Thread RICHARD FERNANDEZ
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of zentara > Sent: Thursday, April 10, 2008 9:31 AM > To: beginners@perl.org > Subject: Re: Sometimes Net::SSH2 can't read() from channel? > > On Wed, 9 Apr 2008 17:20:06 -0400, [EMAIL PROTECTED] ("RIC

Re: Debugger in PErl

2008-04-10 Thread Chas. Owens
On Thu, Apr 10, 2008 at 6:44 AM, jeevs <[EMAIL PROTECTED]> wrote: > Is there a good debugger for perl. I have an application running on > Ubuntu , with apache and mod perl along with mysql. and we are into > reverse engineering the product. And need to debug the code. Is there > any debugger for

Re: Please let me know where can I find practice exercises

2008-04-10 Thread Chas. Owens
On Thu, Apr 10, 2008 at 5:56 AM, hemanth <[EMAIL PROTECTED]> wrote: > Hi, > > I am currently learning perl programming. Please help me by giving > some practice exercises or direct me to the site where i can find > them. snip A good starting exercise is reimplementing various UNIX utilities in

Re: Trying to splice....

2008-04-10 Thread Lokeey
Yeah...I actually figured it out last night, and couldn't find my post to send out the correction. but thanks for the assistance. my final code looks like this.. #!/usr/bin/perl -w # extracting elements using splice @players = ("ryno", "fukudome", "grace", "banks", "santo", "soto",

Debugger in PErl

2008-04-10 Thread jeevs
Is there a good debugger for perl. I have an application running on Ubuntu , with apache and mod perl along with mysql. and we are into reverse engineering the product. And need to debug the code. Is there any debugger for perl other than the internal debugger which we can use other than perl inbui

Please let me know where can I find practice exercises

2008-04-10 Thread hemanth
Hi, I am currently learning perl programming. Please help me by giving some practice exercises or direct me to the site where i can find them. Thanks in Advance! Hemanth -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

RE: Example of FTP w/o Input file? Is it possible to do or not?

2008-04-10 Thread Wagner, David --- Senior Programmer Analyst --- WGO
> -Original Message- > From: Chas. Owens [mailto:[EMAIL PROTECTED] > Sent: Wednesday, April 09, 2008 13:05 > To: Wagner, David --- Senior Programmer Analyst --- WGO > Cc: beginners@perl.org > Subject: Re: Example of FTP w/o Input file? Is it possible to > do or not? > > On Wed, Apr 9, 20

Re: find files created/accessed in last n hours

2008-04-10 Thread Richard Lee
Randal L. Schwartz wrote: "Richard" == Richard Lee <[EMAIL PROTECTED]> writes: Richard> Just out of curiosity to all perl experts in here... Richard> how many times did you guys read entire perl FAQs ? Every time one of you says something that sounds like a FAQ. :-) But serious

Re: Best way to grab lines n thru x of a file

2008-04-10 Thread John W. Krahn
Chas. Owens wrote: On Thu, Apr 10, 2008 at 12:24 PM, Jonathan Mast <[EMAIL PROTECTED]> wrote: Hi, I have a ~125MB file of which I want to read lines n thru n+x and write those into a separate file. What is the best way to go about this? Use the flip-flop operator* (..): perl -ne 'print if $

Re: Best way to grab lines n thru x of a file

2008-04-10 Thread John W. Krahn
Jonathan Mast wrote: Hi, Hello, I have a ~125MB file of which I want to read lines n thru n+x and write those into a separate file. What is the best way to go about this? while ( ) { # read and ignore up to n last if $. == $n - 1; } while ( ) { print; last if $. == $

Re: Trying to splice....

2008-04-10 Thread John W. Krahn
[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] into the middle of @players without removing any elements from @players. so i've done the following... #!/usr/bin/perl -w # extracting elements using splice @players = ("ryno", "fukudome", "grace", "banks", "santo", "soto", "marmol", "sor

Re: Best way to grab lines n thru x of a file

2008-04-10 Thread Jialin Li
or use head and tail command head -n50 file | tail -n30 On Thu, Apr 10, 2008 at 11:54 AM, Chas. Owens <[EMAIL PROTECTED]> wrote: > On Thu, Apr 10, 2008 at 12:24 PM, Jonathan Mast > <[EMAIL PROTECTED]> wrote: > > Hi, I have a ~125MB file of which I want to read lines n thru n+x and > write > > t

Re: Best way to grab lines n thru x of a file

2008-04-10 Thread Chas. Owens
On Thu, Apr 10, 2008 at 12:24 PM, Jonathan Mast <[EMAIL PROTECTED]> wrote: > Hi, I have a ~125MB file of which I want to read lines n thru n+x and write > those into a separate file. What is the best way to go about this? > > thanks > Use the flip-flop operator* (..): perl -ne 'print if $. ==

Re: Best way to grab lines n thru x of a file

2008-04-10 Thread Mathew
I think a simpler solution would be to use head and tail: head -n x > file.txt tail -n x-n file.txt > file2.txt Xavier Noria wrote: On Apr 10, 2008, at 18:24 , Jonathan Mast wrote: Hi, I have a ~125MB file of which I want to read lines n thru n+x and write those into a separate file. What

Re: Best way to grab lines n thru x of a file

2008-04-10 Thread Xavier Noria
On Apr 10, 2008, at 18:24 , Jonathan Mast wrote: Hi, I have a ~125MB file of which I want to read lines n thru n+x and write those into a separate file. What is the best way to go about this? Tie::File -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PRO

Best way to grab lines n thru x of a file

2008-04-10 Thread Jonathan Mast
Hi, I have a ~125MB file of which I want to read lines n thru n+x and write those into a separate file. What is the best way to go about this? thanks

Re: find files created/accessed in last n hours

2008-04-10 Thread Randal L. Schwartz
> "Richard" == Richard Lee <[EMAIL PROTECTED]> writes: Richard> Just out of curiosity to all perl experts in here... Richard> how many times did you guys read entire perl FAQs ? Every time one of you says something that sounds like a FAQ. :-) But seriously, I still skim the FAQ headlines a

Re: Trying to splice....

2008-04-10 Thread Gunnar Hjalmarsson
[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] into the middle of @players without removing any elements from @players. so i've done the following... #!/usr/bin/perl -w # extracting elements using splice @players = ("ryno", "fukudome", "grace", "banks", "santo", "soto", "marmol", "sor

Re: Trying to splice....

2008-04-10 Thread Jay Savage
On Wed, Apr 9, 2008 at 3:14 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] into the middle of @players without removing any elements > from @players. > > so i've done the following... > > #!/usr/bin/perl -w > > # extracting elements using splice > > @players = ("ryno", "f

Re: Testing an array for a match

2008-04-10 Thread itshardtogetone
Hi, How about this :- foreach (@Treasures){ if ($_=~ /:1:2:3:/){ print "do your stuffs here\n": } } - Original Message - From: "Lou Hernsen" <[EMAIL PROTECTED]> To: ; <[EMAIL PROTECTED]> Sent: Thursday, April 10, 2008 1:07 AM Subject: Testing an array for a match Hallo

Trying to splice....

2008-04-10 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] into the middle of @players without removing any elements from @players. so i've done the following... #!/usr/bin/perl -w # extracting elements using splice @players = ("ryno", "fukudome", "grace", "banks", "santo", "soto", "marmol", "sori", "bigZ", "pie"); @dump =

Re: Testing an array for a match

2008-04-10 Thread Jeff Pang
On Thu, Apr 10, 2008 at 1:07 AM, Lou Hernsen <[EMAIL PROTECTED]> wrote: > Hallo > > I have an array > @Treasures > and I want to match anywhere in it for > /:1:2:3:/ > can I > if (@Treasures =~ /:1:2:3:/){} > or do i have to change (@Treasures to $Treasures and then > $Treasures = @Treasure

Re: find files created/accessed in last n hours

2008-04-10 Thread Richard Lee
Chas. Owens wrote: On Thu, Apr 10, 2008 at 1:42 AM, nag <[EMAIL PROTECTED]> wrote: hi, please help me to get all the files present in a directory which are created/accessed in last 4 hours . snip Take a look at File::Find* and the stat function** or -M***. You may also want to read

Re: New and not sure how to approach this?

2008-04-10 Thread John W. Krahn
Gladstone Daniel - dglads wrote: Good afternoon all, Hello, I am new to Perl, so I ask you in advance for your indulgences. I have a file of 82,000 lines in a fixed format of 130 characters on each line, with a line feed. Given the layout: Field1 = Position 1-5 Field2 = Position 6-20 F

Testing an array for a match

2008-04-10 Thread Lou Hernsen
Hallo I have an array @Treasures and I want to match anywhere in it for /:1:2:3:/ can I if (@Treasures =~ /:1:2:3:/){} or do i have to change (@Treasures to $Treasures and then $Treasures = @Treasures ; if ($Treasures =~ /:1:2:3:/){} Just thought I'd ask first, I have to take mother in law to Dr.

New and not sure how to approach this?

2008-04-10 Thread Gladstone Daniel - dglads
Good afternoon all, I am new to Perl, so I ask you in advance for your indulgences. I have a file of 82,000 lines in a fixed format of 130 characters on each line, with a line feed. Given the layout: Field1 = Position 1-5 Field2 = Position 6-20 Field3 = Position 21-30 and so on and so on f

New and not sure how to approach this?

2008-04-10 Thread Gladstone Daniel - dglads
Good afternoon all, I am new to Perl, so I ask you in advance for your indulgences. I have a file of 82,000 lines in a fixed format of 130 characters on each line, with a line feed. Given the layout: Field1 = Position 1-5 Field2 = Position 6-20 Field3 = Position 21-30 and so on and so on f