some errors in databasescript

2009-09-17 Thread Ruprecht Helms
Hi, I've written a little perlscript that should write the output of databasetables into a textfile. But unfortunately I get some syntaxerrors that a least I'm not able to reproduce. syntax error at ./statistik.pl line 73, near } or syntax error at ./statistik.pl line 82, near ) { syntax error

Re: some errors in databasescript

2009-09-17 Thread Alexander Koenig
Hi Ruprecht, You wrote on 09/17/2009 10:31 AM: syntax error at ./statistik.pl line 73, near } or syntax error at ./statistik.pl line 82, near ) { syntax error at ./statistik.pl line 86, near } or Missing right curly or square bracket at ./statistik.pl line 100, at end of line Execution of

Typeglobs, constants and sub refs

2009-09-17 Thread Matteo Riva
After reading Uri's post about projects for beginners, I took a quick look at File::Slurp source code, and I was stuck at the very beginning. My knowledge of Perl is still very beginner level, but I want - time allowing - to improve as I like the language very much. Anyway, the code starts with

Strange Data space wipe out with hashes

2009-09-17 Thread Jerry Rocteur
Hi, I came across this problem and thought I'd run it by the list so that perhaps someone can explain to me what is going on Given a script with the following hash definition #!/usr/bin/perl use warnings; use strict; my %sib_master_hoa = ( = [ ' type' ] ,

Re: some errors in databasescript

2009-09-17 Thread Ruprecht Helms
Alexander Koenig wrote: Hi Ruprecht, You wrote on 09/17/2009 10:31 AM: syntax error at ./statistik.pl line 73, near } or syntax error at ./statistik.pl line 82, near ) { syntax error at ./statistik.pl line 86, near } or Missing right curly or square bracket at ./statistik.pl line 100, at

Re: Strange Data space wipe out with hashes

2009-09-17 Thread Shawn H Corey
Jerry Rocteur wrote: Hi, I came across this problem and thought I'd run it by the list so that perhaps someone can explain to me what is going on Given a script with the following hash definition #!/usr/bin/perl use warnings; use strict; my %sib_master_hoa = ( = [

Re: some errors in databasescript

2009-09-17 Thread Uri Guttman
RH == Ruprecht Helms rhe...@rheynmail.de writes: RH Alexander Koenig wrote: Missing right curly or square bracket at ./statistik.pl line 100, at end of line Execution of ./statistik.pl aborted due to compilation errors. Line numbers would have been great. and you can just

Re: Typeglobs, constants and sub refs

2009-09-17 Thread Uri Guttman
MR == Matteo Riva mura...@gmail.com writes: MR After reading Uri's post about projects for beginners, I took a quick MR look at File::Slurp source code, and I was stuck at the very beginning. looking at my code is a good way to learn perl! :) MR # Install subs for various constants that

Re: Strange Data space wipe out with hashes

2009-09-17 Thread Uri Guttman
JR == Jerry Rocteur p...@rocteur.cc writes: JR my %sib_master_hoa = ( JR = [ ' type' ] , JR _ERSALL = [ ' type', 'ERS CRCODOSS type', 'ERS ENVDOSS type', 'ERS ENVVAL type' ], JR _ERSOTHERS = [ ' type', 'ERS CRCODOSS

Re: Typeglobs, constants and sub refs

2009-09-17 Thread Matteo Riva
On Thu, Sep 17, 2009 at 5:56 PM, Uri Guttman u...@stemsystems.com wrote: hopefully that explains it. Unfortunately, not really :) I *know* about the symbol table and typeglobs, but I yet have to *understand* how it all works, and how to use it. My first question here - before everything else

Re: Typeglobs, constants and sub refs

2009-09-17 Thread Uri Guttman
MR == Matteo Riva mura...@gmail.com writes: MR On Thu, Sep 17, 2009 at 5:56 PM, Uri Guttman u...@stemsystems.com wrote: hopefully that explains it. MR Unfortunately, not really :) so ask a more detailed question! MR I *know* about the symbol table and typeglobs, but I yet have to

Re: Typeglobs, constants and sub refs

2009-09-17 Thread Chas. Owens
On Thu, Sep 17, 2009 at 13:34, Matteo Riva mura...@gmail.com wrote: On Thu, Sep 17, 2009 at 5:56 PM, Uri Guttman u...@stemsystems.com wrote: hopefully that explains it. Unfortunately, not really :) I *know* about the symbol table and typeglobs, but I yet have to *understand* how it all

push and split

2009-09-17 Thread Noah Garrett Wallach
Hi there, I am attempting to read a text file in to two array variables. --- text file --- hostname1 ip1 hostname2 ip2 --- text file --- so basically I would like to have the items in column become an the elements of an array @routers and then the items in column two in an array variable

Re: Typeglobs, constants and sub refs

2009-09-17 Thread Matteo Riva
On Thu, Sep 17, 2009 at 7:45 PM, Chas. Owens chas.ow...@gmail.com wrote: Constants have a value beyond the numbers themselves.  Let's suppose that there is a non-POSIX system that has a seek function that works quite a bit like POSIX seek, but it use different values for beginning of file,

Re: push and split

2009-09-17 Thread Steve Bertrand
Noah Garrett Wallach wrote: Hi there, I am attempting to read a text file in to two array variables. --- text file --- hostname1 ip1 hostname2 ip2 --- text file --- so basically I would like to have the items in column become an the elements of an array @routers and then the

Re: push and split

2009-09-17 Thread Chas. Owens
On Thu, Sep 17, 2009 at 14:05, Noah Garrett Wallach noah-l...@enabled.com wrote: Hi there, I am attempting to read a text file in to two array variables. --- text file --- hostname1 ip1 hostname2 ip2 --- text file --- so basically I would like to have the items in column become an the

Re: Typeglobs, constants and sub refs

2009-09-17 Thread Chas. Owens
On Thu, Sep 17, 2009 at 14:13, Matteo Riva mura...@gmail.com wrote: On Thu, Sep 17, 2009 at 7:45 PM, Chas. Owens chas.ow...@gmail.com wrote: Constants have a value beyond the numbers themselves.  Let's suppose that there is a non-POSIX system that has a seek function that works quite a bit

Re: push and split

2009-09-17 Thread Chas. Owens
On Thu, Sep 17, 2009 at 14:13, Steve Bertrand st...@ibctech.ca wrote: Noah Garrett Wallach wrote: Hi there, I am attempting to read a text file in to two array variables. --- text file --- hostname1 ip1 hostname2 ip2 --- text file --- so basically I would like to have the items in

Re: Typeglobs, constants and sub refs

2009-09-17 Thread Uri Guttman
MR == Matteo Riva mura...@gmail.com writes: MR Hm no maybe I didn't explain myself: my doubt was not about the MR use of constants, but about the strange way of defining MR them. What I thought when reading it was: Why not just 'use MR constant ...' ?. And later But how exactly does it

Re: Typeglobs, constants and sub refs

2009-09-17 Thread Matteo Riva
On Thu, Sep 17, 2009 at 8:18 PM, Chas. Owens chas.ow...@gmail.com wrote: Ah, use constant is just sugar for what he is doing.  And, given that he is only adding the constants because they don't exist in very old versions of Perl, it is likely that he is trying to support a version of Perl

Re: push and split

2009-09-17 Thread Steve Bertrand
Chas. Owens wrote: On Thu, Sep 17, 2009 at 14:13, Steve Bertrand st...@ibctech.ca wrote: Noah Garrett Wallach wrote: Hi there, I am attempting to read a text file in to two array variables. --- text file --- hostname1 ip1 hostname2 ip2 --- text file --- so basically I would like to

Re: Typeglobs, constants and sub refs

2009-09-17 Thread Matteo Riva
On Thu, Sep 17, 2009 at 8:22 PM, Uri Guttman u...@stemsystems.com wrote: the strange way is because that is how perl does it. perl doesn't have a proper macro mechanism which is how many langs do constants. so it needs something that is parsed in perl and subs with empty prototypes work well.

Re: Typeglobs, constants and sub refs

2009-09-17 Thread Uri Guttman
CO == Chas Owens chas.ow...@gmail.com writes: CO Ah, use constant is just sugar for what he is doing. And, given that CO he is only adding the constants because they don't exist in very old CO versions of Perl, it is likely that he is trying to support a version CO of Perl prior to

Re: push and split

2009-09-17 Thread Noah Garrett Wallach
Steve Bertrand wrote: Noah Garrett Wallach wrote: Hi there, I am attempting to read a text file in to two array variables. --- text file --- hostname1 ip1 hostname2 ip2 --- text file --- so basically I would like to have the items in column become an the elements of an array @routers and

Re: push and split

2009-09-17 Thread Steve Bertrand
Noah Garrett Wallach wrote: Steve Bertrand wrote: Noah Garrett Wallach wrote: Hi there, I am attempting to read a text file in to two array variables. --- text file --- hostname1 ip1 hostname2 ip2 --- text file --- so basically I would like to have the items in column become an the

Re: push and split

2009-09-17 Thread Uri Guttman
SB == Steve Bertrand st...@ibctech.ca writes: SB Another thing, as Chas pointed out, hashes are unorganized, which means SB that the order of retrieval is almost always different than the order of SB insertion: just to clarify that, there is no order of retrieval of hash keys, it appears

matching multi occurrences or nothing

2009-09-17 Thread Noah Garrett Wallach
Hi there Perl folks, Okay I am trying to figure this out. I am trying to match the following: $line = blahblahblah so I have the following line to match that $line =~ /((?:blah).*?){0,5}/; But I want to capture blah in a variable like $capture = $1; or something like that? am I on the

Re: push and split

2009-09-17 Thread Noah Garrett Wallach
Chas. Owens wrote: On Thu, Sep 17, 2009 at 14:05, Noah Garrett Wallach noah-l...@enabled.com wrote: Hi there, I am attempting to read a text file in to two array variables. --- text file --- hostname1 ip1 hostname2 ip2 --- text file --- so basically I would like to have the items in column

Re: matching multi occurrences or nothing

2009-09-17 Thread Chas. Owens
On Thu, Sep 17, 2009 at 16:23, Noah Garrett Wallach noah-l...@enabled.com wrote: Hi there Perl folks, Okay I am trying to figure this out. I am trying to match the following: $line = blahblahblah so I have the following line to match that $line =~ /((?:blah).*?){0,5}/; But I want to

Re: matching multi occurrences or nothing

2009-09-17 Thread Jim Bauer
Noah Garrett Wallach noah-l...@enabled.com wrote on Thu, 17 Sep 2009 13:23:37 -0700 Hi there Perl folks, Okay I am trying to figure this out. I am trying to match the following: $line = blahblahblah so I have the following line to match that $line =~ /((?:blah).*?){0,5}/; But I want to

Re: push and split

2009-09-17 Thread Jim Gibson
On 9/17/09 Thu Sep 17, 2009 12:41 PM, Uri Guttman u...@stemsystems.com scribbled: SB == Steve Bertrand st...@ibctech.ca writes: SB while ( my $entry = DATA ) { SB my ( $router, $ip ) = split /\s+/, $entry; SB next if ! defined $ip; how would $ip not be defined if