Re: first post

2011-07-20 Thread John W. Krahn
H Kern wrote: Hi, Hello, My first newbie post. I wish to have two arrays indexed by a hash table. The simple program below runs and behaves properly initializing the hash table with the information I wish it to have. However, Perl generates the following suggestion on the @header{} assignmen

Re: Arrow Notation vs. Colon Notation

2011-07-20 Thread Rob Dixon
On 21/07/2011 05:32, Rob Dixon wrote: It would be possible to generate calls to undefined subroutines at compile time, but because the symbol table can be modified at run time with such trickery suck as *Foo::bar = \&Foo::foo it is also left until run time to report any such errors. My apolog

Re: second post

2011-07-20 Thread Uri Guttman
> "HK" == H Kern writes: HK> Just a followup on that last one... HK> I'm using this code thinking that ($header{"info}) will be an array of HK> all the elements in the string that was read in. HK> But, when the perl compiler gets to the second print statement, it balks. HK> "Can'

Re: second post

2011-07-20 Thread Rob Dixon
On 21/07/2011 05:34, H Kern wrote: Just a followup on that last one... I'm using this code thinking that ($header{"info}) will be an array of all the elements in the string that was read in. The first print statement does what I hope, printing out the elements of that array as a string. But, w

Re: first post

2011-07-20 Thread Uri Guttman
> "SHC" == Shawn H Corey writes: SHC> On 11-07-20 10:28 PM, H Kern wrote: >> use strict; >> use warnings; >> my %header; >> >> open( IN, "<", $ARGV[0] ); >> >> @header{"keys"} = split(/\t\n/, ); >> @header{"info"} = split(/\t\n/, ); SHC> I'm not sure but I think this is

Re: Arrow Notation vs. Colon Notation

2011-07-20 Thread Uri Guttman
> "RD" == Rob Dixon writes: RD> I'm not sure what you mean here Shawn. Errors are generated at run time RD> in both cases, so code like RD> if (0) { RD> Foo::bar(); RD> } RD> if (0) { Foo-> bar(); RD> } RD> will generate no errors at all. In particular the meth

Re: second post

2011-07-20 Thread jbiskofski
If you want to store an array inside a hash value you have to store a reference to it, not the actual array. Here are two examples : my %hash; my @arr = split(...); $hash{'key'} = \@arr; Or shorter : $hash{'key'} = [ split(...) ]; Cheers dude! -- biskofski Sent from my iPad On Jul 20, 2011

second post

2011-07-20 Thread H Kern
Just a followup on that last one... I'm using this code thinking that ($header{"info}) will be an array of all the elements in the string that was read in. The first print statement does what I hope, printing out the elements of that array as a string. But, when the perl compiler gets to

Re: Arrow Notation vs. Colon Notation

2011-07-20 Thread Rob Dixon
On 21/07/2011 02:09, Shawn H Corey wrote: On 11-07-20 07:03 PM, Uri Guttman wrote: the other is a class method call. it has two major differences. first it will pass its class (or object, the arg before ->) as the first arg in the call. the second thing is that it will search the class hierarchy

Re: first post

2011-07-20 Thread Shawn H Corey
On 11-07-20 10:28 PM, H Kern wrote: use strict; use warnings; my %header; open( IN, "<", $ARGV[0] ); @header{"keys"} = split(/\t\n/, ); @header{"info"} = split(/\t\n/, ); I'm not sure but I think this is what you want: ( $header{"keys"}, $header{"info"} ) = split(/\t\n/, ); Also, Data::Dum

first post

2011-07-20 Thread H Kern
Hi, My first newbie post. I wish to have two arrays indexed by a hash table. The simple program below runs and behaves properly initializing the hash table with the information I wish it to have. However, Perl generates the following suggestion on the @header{} assignment statements, "S

Re: redirect system command STDER

2011-07-20 Thread C.DeRykus
On Jul 20, 12:45 am, walde.christ...@googlemail.com ("Christian Walde") wrote: > On Tue, 19 Jul 2011 21:14:10 +0200, Tessio Fechine wrote: > > Hello, > > I have a subroutine that uses useradd to create accounts > > > -- > > @cmd = ('useradd', '-m', $account); > > my $result = system @cmd; > > -- >

Re: Arrow Notation vs. Colon Notation

2011-07-20 Thread Shawn H Corey
On 11-07-20 07:03 PM, Uri Guttman wrote: the other is a class method call. it has two major differences. first it will pass its class (or object, the arg before ->) as the first arg in the call. the second thing is that it will search the class hierarchy (using the package global's @ISA) to find

Re: Arrow Notation vs. Colon Notation

2011-07-20 Thread jbiskofski
Marc that was a really good question. On the surface they do seem exactly alike. Cheers! - biskofski On Jul 20, 2011, at 6:29 PM, Marc wrote: > On Jul 20, 2011, at 4:03 PM, Uri Guttman wrote: > >> so don't think they are even similar as one is a sub call and the other >> is a class method c

Re: Arrow Notation vs. Colon Notation

2011-07-20 Thread Marc
On Jul 20, 2011, at 4:03 PM, Uri Guttman wrote: > so don't think they are even similar as one is a sub call and the other > is a class method call. they aren't interchangeble at all Yep, you're correct. Why is everything so simple once someone explains it to you??? =;) That al

Re: XML suggestions

2011-07-20 Thread Jenda Krynicky
From: Rob Coops > It really depends on what you are looking to do though, if you are aiming > for just a simple thing with only a few messages then don't worry > about XML::LibXML > and go for XML::Simple which is more then enough in most simple cases ;-) Except that it's not so simple to set i

Re: Arrow Notation vs. Colon Notation

2011-07-20 Thread Uri Guttman
> "M" == Marc writes: M>I've noticed that the following two lines seem to be equivalent when calling a sub from a module called Lib.pm: Lib-> load_config("config.dat"); M> Lib::load_config("config.dat"); M>Is this just a case of TIMTOWTDI or is there a difference in how

Arrow Notation vs. Colon Notation

2011-07-20 Thread Marc
I've noticed that the following two lines seem to be equivalent when calling a sub from a module called Lib.pm: Lib->load_config("config.dat"); Lib::load_config("config.dat"); Is this just a case of TIMTOWTDI or is there a difference in how they do what they do? Marc -- To uns

Subdirectories and use lib

2011-07-20 Thread Marc
I'd like to organize a project's files into subdirectories for better housekeeping. I thought that use lib "."; would also include any subdirectories, but sadly it doesn't. Is there a way to include all subdirs without having a list a mile long like this? use lib "/Applications/MAMP/cg

Re: Increment UID Field

2011-07-20 Thread Rob Coops
On Wed, Jul 20, 2011 at 9:53 PM, Shlomi Fish wrote: > Hi Overkill, > > On Wed, 20 Jul 2011 13:24:06 -0400 > Overkill wrote: > > > Greetings, > > > > I'm trying to increment the UID field of the unix password file from an > > csv file. I've tried to insert C style increment and it keeps bomping

Re: Increment UID Field

2011-07-20 Thread Shlomi Fish
Hi Overkill, On Wed, 20 Jul 2011 13:24:06 -0400 Overkill wrote: > Greetings, > > I'm trying to increment the UID field of the unix password file from an > csv file. I've tried to insert C style increment and it keeps bomping > out. What would be the logic to increment the 5009 to increment

Re: Increment UID Field

2011-07-20 Thread Overkill
Rob, great ideas and worked like a charm. Thanks again, Overkill. On 07/20/2011 01:42 PM, Rob Coops wrote: On Wed, Jul 20, 2011 at 7:24 PM, Overkill wrote: Greetings, I'm trying to increment the UID field of the unix password file from an csv file. I've tried to insert C style increment and

Re: Increment UID Field

2011-07-20 Thread Rob Coops
On Wed, Jul 20, 2011 at 7:24 PM, Overkill wrote: > Greetings, > > I'm trying to increment the UID field of the unix password file from an csv > file. I've tried to insert C style increment and it keeps bomping out. > What would be the logic to increment the 5009 to increment by one? Thanks > f

Re: help to print a hash with hash

2011-07-20 Thread Brandon McCaig
Hello: On Wed, Jul 20, 2011 at 12:45 PM, Mohan L wrote: > It trying to store that string into the first column and nothing into > the subsequent columns. That is why it  shows "column cannot be null" > error messages. Thanks Jim Gibson!!!. > > Jim Gibson, I understand the problem, but I not sure

Increment UID Field

2011-07-20 Thread Overkill
Greetings, I'm trying to increment the UID field of the unix password file from an csv file. I've tried to insert C style increment and it keeps bomping out. What would be the logic to increment the 5009 to increment by one? Thanks for any help. -Overkill #!/usr/bin/perl #use strict; #u

Re: help to print a hash with hash

2011-07-20 Thread Mohan L
> > east,0,0,2,4,0,0,0,6 > > north,0,0,7,3,0,0,0,10 > > south,3,0,1,3,0,0,0,7 > > west,7,0,0,0,0,0,0,7 > > If that is really the output from the print statement shown above, then you > don't have a rows of column data in your @dbdata array elements, you have > an > array of scalar string values tha

Re: Regular Expression change

2011-07-20 Thread Rob Dixon
On 15/07/2011 16:42, David Wagner wrote: I have the following map: map{[$_,(/^\d/ ? 1 : 0) . /^([^;]+)/, /[^;]+;[^;]*;[^;]+;[^;]+;([^;]+);/]} I had a failure during the night because some data field(s) had a semi-colon in the data. So what I have is a

Re: help to print a hash with hash

2011-07-20 Thread Jim Gibson
On 7/20/11 Wed Jul 20, 2011 9:04 AM, "Mohan L" scribbled: > On Wed, Jul 20, 2011 at 9:23 PM, shawn wilson wrote: > >> On Wed, Jul 20, 2011 at 10:41, Mohan L wrote: >> >>> >>> DBD::mysql::st execute failed: Column 'open' cannot be null at >>> ./demo.plline 104, line 30. >>> DBD::mysql::st

Re: help to print a hash with hash

2011-07-20 Thread Mohan L
On Wed, Jul 20, 2011 at 9:23 PM, shawn wilson wrote: > On Wed, Jul 20, 2011 at 10:41, Mohan L wrote: > > > > > DBD::mysql::st execute failed: Column 'open' cannot be null at > > ./demo.plline 104, line 30. > > DBD::mysql::st execute failed: Column 'open' cannot be null at > > ./demo.plline 104,

Re: help to print a hash with hash

2011-07-20 Thread shawn wilson
On Wed, Jul 20, 2011 at 10:41, Mohan L wrote: > > DBD::mysql::st execute failed: Column 'open' cannot be null at > ./demo.plline 104, line 30. > DBD::mysql::st execute failed: Column 'open' cannot be null at > ./demo.plline 104, line 30. > DBD::mysql::st execute failed: Column 'open' cannot be

Re: help to print a hash with hash

2011-07-20 Thread Mohan L
How to insert below data structure in data base? #!/usr/bin/perl > >> use strict; >> use warnings; >> >> my %data = ( >> >> south => { >> status => { >> open => { count => 3 }, >> pws => { count => 3 }, >> wip => { count => 0 }, >> hold => { count => 1 }, >> 're-open' => { count => 0 }

Fw: redirect system command STDER

2011-07-20 Thread Shlomi Fish
Hi, we keep receiving these messages when posting to beginners@perl.org. Can you please unsubscribe lel...@claimspages.com from it? Regards, -- Shlomi Fish -- - Shlomi Fish http://www.shlomifish.org/ My Aphorisms - http://ww

Re: redirect system command STDER

2011-07-20 Thread Shlomi Fish
Hi Jim, On Tue, 19 Jul 2011 16:22:14 -0700 Jim Gibson wrote: > On 7/19/11 Tue Jul 19, 2011 12:14 PM, "Tessio Fechine" > scribbled: > > > Hello, > > I have a subroutine that uses useradd to create accounts > > > > -- > > @cmd = ('useradd', '-m', $account); > > my $result = system @cmd; > > -

Re: redirect system command STDER

2011-07-20 Thread Kevin Spencer
On Tue, Jul 19, 2011 at 12:14 PM, Tessio Fechine wrote: > Hello, > I have a subroutine that uses useradd to create accounts > > -- > @cmd = ('useradd', '-m', $account); > my $result = system @cmd; > -- > > but when useradd fails, I need to stop it from sending the error message to > STDER. > Is it

Re: redirect system command STDER

2011-07-20 Thread Christian Walde
On Tue, 19 Jul 2011 21:14:10 +0200, Tessio Fechine wrote: Hello, I have a subroutine that uses useradd to create accounts -- @cmd = ('useradd', '-m', $account); my $result = system @cmd; -- but when useradd fails, I need to stop it from sending the error message to STDER. Is it possible with