Re:

2003-12-31 Thread R. Joseph Newton
Eric Walker wrote: > > > Ok thanks for that info. Now is there a way to move back up the file > and get previous lines or do you have to store them in a variable and > use them later. Yes and no. Yes there is, but no, you are probably not ready to use this well. Perl does have tell and seek f

Re: Integer out of range.....

2003-12-31 Thread Bee
Thanks a lot, Rob. Thaz exactly what I am looking for... =) - Original Message - From: "Rob Dixon" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, January 01, 2004 4:12 AM Subject: Re: Integer out of range. > Bee wrote: > > > > Anything I can do to working like this ?

Simple Hash Question / NEVER MIND

2003-12-31 Thread Jeff Westman
DOH . DOH . NEVER MIND, user error ( <- gun to head) DOH . DOH . DOH . Hi I have a hash defined as my %flag3 = ( A => "DBSpace backup thread", B => "Begin work", C => "Commiting/committ

Simple Hash Question

2003-12-31 Thread Jeff Westman
Hi I have a hash defined as my %flag3 = ( A => "DBSpace backup thread", B => "Begin work", C => "Commiting/committed", H => "Heuristic aborting/aborted", P => "Preparing/prepared", R => "Aborting/aborted", X

Re: Problem with READDIR

2003-12-31 Thread Owen
On Tue, 30 Dec 2003 19:07:26 -0800 "Perl" <[EMAIL PROTECTED]> wrote: > I have a problem with the following block of code. It works fine when > there isn't a *.log file in the same directory as the script but when > there is, it always returns that log as the newest file and ignores the > list of

Re:

2003-12-31 Thread Eric Walker
On Wed, 2003-12-31 at 14:35, James Edward Gray II wrote: On Dec 31, 2003, at 3:05 PM, Eric Walker wrote: > Ok thanks for that info. Now is there a way to move back up the file > and get previous lines or do you have to store them in a variable and > use them later. W

Re:

2003-12-31 Thread James Edward Gray II
On Dec 31, 2003, at 3:05 PM, Eric Walker wrote: Ok thanks for that info. Now is there a way to move back up the file and get previous lines or do you have to store them in a variable and use them later. Well, you got lot's of information about this yesterday, I believe. You can store them in va

Re:

2003-12-31 Thread Eric Walker
On Wed, 2003-12-31 at 13:27, James Edward Gray II wrote: On Dec 31, 2003, at 11:57 AM, Eric Walker wrote: > OK, some how my $_ variable is out of sync with my <> operator. > if I print out $_ I get line a of my file and if I do a my $test = > , and print out $test I get a diff

Re: Hi & a question

2003-12-31 Thread drieux
On Dec 31, 2003, at 8:28 AM, John McKown wrote: For only 4 variables, I thought it was overkill to have an "ini" file. However as I continue to mess around with my code, I'm adding more and more externalized variables. Use of an "ini" is becoming more appealing. john, for what it is worth - cf:

Re: command line search and replace

2003-12-31 Thread drieux
On Dec 31, 2003, at 8:22 AM, Randy Brown wrote: Ah yes, now the real stumper: The line: perl -pi -e 's/file:.*<\/provider-url>/REPLACED/' testfile.txt does in fact work fine from the commandline in unix. However, when it is called from a ksh script, it does not function. Any ideas? I have trie

Re:

2003-12-31 Thread James Edward Gray II
On Dec 31, 2003, at 11:57 AM, Eric Walker wrote: OK, some how my $_ variable is out of sync with my <> operator. if I print out $_ I get line a of my file and if I do a my $test = , and print out $test I get a different line that is more than the next line away. example. I am the best you are the

Re:

2003-12-31 Thread Rob Dixon
Eric Walker wrote: > > Yea, I did do the $test = ; > > Is there anyway to sync them back up instead of rewriting my code? Hi Eric. It depends on what you want to do. Every time Perl executes it pulls a new record from the file, whether it's in the condition of a 'while' loop or in a statement o

Re: Integer out of range.....

2003-12-31 Thread Rob Dixon
Bee wrote: > > Anything I can do to working like this ? > > print for ( 0.. 3410068347520) ; > > Thanks in advise Hi Bee. Use Math::BigInt, like this. (The underscores in the constant are optional, as for normal Perl integers.) HTH, Rob use strict; use warnings; use Math::BigInt; m

RE:

2003-12-31 Thread Tim Johnson
Well, I guess it depends on why you were assigning to $test. If you were doing it because you wanted to assign the current line of the program to $test, you could just cut out the middleman and do something like: while($test = ){ or if you just want to check the status of the current line s

RE:

2003-12-31 Thread Eric Walker
Yea, I did do the $test = ; Is there anyway to sync them back up instead of rewriting my code? On Wed, 2003-12-31 at 12:51, Tim Johnson wrote: Well, this sounds like a basic coding mistake, but you haven't actually shown us any of your code. My best bit of advice would be to 1) use strict,

RE:

2003-12-31 Thread Tim Johnson
Well, this sounds like a basic coding mistake, but you haven't actually shown us any of your code. My best bit of advice would be to 1) use strict, 2) use warnings, and 3) check if you're doing something along these lines: while(){ print $_; $test = ; print $test; } which woul

RE: Perl Newbie question: How would you take keyboard input and run a shell scrip with that input?

2003-12-31 Thread Paul Kraus
I don't think you could be vaguer :) Very basic #!/usr/bin/perl # update.pl multiple options command line my @packages = @ARGV foreach (@packages){ system(packageexecutableforupdate); #with output captured My $output = `packageexecutableforupdate`; } Not tested of cou

beginners@perl.org

2003-12-31 Thread Eric Walker
OK, some how my $_ variable is out of sync with my <> operator. if I print out $_ I get line a of my file and if I do a my $test = , and print out $test I get a different line that is more than the next line away. example. I am the best you are the best we are the best they are the best. print $

Re: piped system commands

2003-12-31 Thread drieux
On Dec 31, 2003, at 9:04 AM, deb wrote: Drieux, Vladimir??? yes, named after vladimir ilyich, it is my Sparc Box. :-) Thanks for the hints. :-) Personally I would be doing it with something like Which of course first started out as

Integer out of range.....

2003-12-31 Thread Bee
Anything I can do to working like this ? print for ( 0.. 3410068347520) ; Thanks in advise

Re: Use of uninitialized value complaint

2003-12-31 Thread Rob Dixon
Deb wrote: > > At 17:26:25, on 12.31.03: > Cracks in my tinfoil beanie > allowed Rob Dixon to seep these bits into my brain:, > > > (full marks for using -w but 'use strict' would help even more). > > Ack! Caught me again. I guess I'm not paying attention! We're not going to leave you alone unti

Re: Help with extracting text

2003-12-31 Thread Rob Dixon
Deb wrote: > > I need help understanding why I'm getting this complaint, > > Use of uninitialized value in concatenation (.) or string at test.pl line 2. > > It says its unitialized, but isn't the my $status initializing the scalar? > I'm so confused. > > Here's the code: > > > #!/usr/local/bin/per

Re: Use of uninitialized value complaint

2003-12-31 Thread deb
Please see response, inline: At 17:26:25, on 12.31.03: Cracks in my tinfoil beanie allowed Rob Dixon to seep these bits into my brain:, > > Hi Deb. Hi Rob! > Perl is trying to expand $2 in your string. Since Perl's $2 is undefined it > gives you the warning (full marks for using -w but 'use str

RE: Problem with READDIR

2003-12-31 Thread Perl
Try putting a copy of 1.log in your working directory as well as having it in your faraway directory. For me, the 1.log will always appear first on the sort. --Paul -Original Message- From: Owen [mailto:[EMAIL PROTECTED] Posted At: Tuesday, December 30, 2003 10:35 PM Posted To: Perl Conv

Re: Use of uninitialized value complaint

2003-12-31 Thread Rob Dixon
Deb wrote: > > I need help understanding why I'm getting this complaint, > > Use of uninitialized value in concatenation (.) or string at test.pl line 2. > > It says its unitialized, but isn't the my $status initializing the scalar? > I'm so confused. > > Here's the code: > > > #!/usr/local/bin/per

Re: piped system commands

2003-12-31 Thread deb
At 15:58:26, on 12.30.03: Cracks in my tinfoil beanie allowed Bakken, Luke to seep these bits into my brain:, > > Instead of the useless 'grep -v grep', do this: > > % ps -ef | egrep '[/]usr/lib/sendmail' | awk '{print $2}' Ah, yes, much cleaner. Old habits die hard. :-) > > But, when I put t

Re: piped system commands

2003-12-31 Thread deb
At 17:50:40, on 12.30.03: Cracks in my tinfoil beanie allowed Andrew Gaffney to seep these bits into my brain:, > Try changing the $2 to \$2. Perl is interpolating $2 before it gets to > bash, so bash sees "/bin/awk '{print }'". > > -- Andrew, Ah!!! That was it. I should have seen that. Th

Use of uninitialized value complaint

2003-12-31 Thread deb
I need help understanding why I'm getting this complaint, Use of uninitialized value in concatenation (.) or string at test.pl line 2. It says its unitialized, but isn't the my $status initializing the scalar? I'm so confused. Here's the code: #!/usr/local/bin/perl -w my $status = `ps -ef |

Perl Newbie question: How would you take keyboard input and run a shell scrip with that input?

2003-12-31 Thread Jeff Collins
For example: I would like for the user to enter the name of a software package to use and then call a shell script to use that package name to upgrade software. Thanks = Jeffrey T. Collins [EMAIL PROTECTED] __ Do you Yahoo!? Find out what made the Top Yahoo

Re: Hi & a question

2003-12-31 Thread John McKown
Daniel, For only 4 variables, I thought it was overkill to have an "ini" file. However as I continue to mess around with my code, I'm adding more and more externalized variables. Use of an "ini" is becoming more appealing. Thanks for your thoughts! On Sun, 28 Dec 2003, Daniel Staal wrote: >

RE: command line search and replace

2003-12-31 Thread Randy Brown
Ah yes, now the real stumper: The line: perl -pi -e 's/file:.*<\/provider-url>/REPLACED/' testfile.txt does in fact work fine from the commandline in unix. However, when it is called from a ksh script, it does not function. Any ideas? I have tried many possible combinations that I can th

Re: Help with extracting text

2003-12-31 Thread William Martell
Hi Rob, Just curious about your code. When you write while (){ how does Perl know what data you are talking about. Is it implied or is Perl using $_ or @_, or something like this. Please explain your code a little for me, I'm still a newbie. Thanks Will Martell Dallas Texas - Original Me

Re: Help with extracting text

2003-12-31 Thread Rob Dixon
Zary Necheva wrote: > > How can I extract the text before the first occurrence of dot (.) or > single space from the first field. > > This is my file > > LB1571 5TH .W43 1993|text1|text1| > FICT. V.12|text2|text2| > FICT.|text3|text3| > HQ806 .B35 1995|text4|text4| > G530.T6B4941988Q|text5|text5|

scripted piped system commands

2003-12-31 Thread deb
Happy Almost New Year! I want to run a unix system command inside a script. From the shell, here's the command(s): % ps -ef | /bin/egrep '/usr/lib/sendmail' | /bin/grep -v grep | /bin/awk '{print $2}' 19460 What is returned is the pid of the process being grep'd. But, when I put this into a te

RE: : Help with extracting text

2003-12-31 Thread Halkyard, Jim
Hi Will, Just a couple of comments on the script you sent. This is your script with some minor changes. $infile = "zary_necheva_data.txt"; open(INFILE, $infile) or die "Death $!"; while( $line = ){ $lpos = index($line,"|"); # Your line will capture the first five chars, but in the sample

RE:: Help with extracting text

2003-12-31 Thread William Martell
Hi Zary, I have attached a sample file with the data you offered and a perl script which can be copied and pasted into the command line on win32. Let me know if you have any problems. HTH, Will Martell Dallas Texas LB1571 5TH .W43 1993|text1|text1| FICT. V.12|text2|text2| FICT.|text3|text3| HQ80

Re: $_

2003-12-31 Thread Rob Dixon
Eric Walker wrote: > > On Tue, 2003-12-30 at 16:39, Rob Dixon wrote: > Eric Walker wrote: > > > > I am going through a file and when I enter a certain routine, I am > > entering a while loop with the construct. Is there a way to back > > the counter up or back up one line befo

Re: make problem with xs file (Time::Object)

2003-12-31 Thread Will Glass-Husain
Great! I'm impressed. That was really quite obscure. For the record, here's how I installed Time-Object following your advice (changing the name of the two subroutines to avoid name conflicts with Perl 5.8.x) perl -MCPAN -e 'get Time::Object' cd /tmp/.cpan/build/Time-Object-1.00 perl -pi -e "s/i