Re: Q: how to push into array

2008-01-12 Thread Jenda Krynicky
From: ciwei <[EMAIL PROTECTED]> > On Jan 10, 9:41 am, [EMAIL PROTECTED] (Chas. Owens) wrote: > > > __DATA__ > > >              DEV01-HBA0_DMX1-13CA  <-- begin of record > > >               WWN: 1000C934A35B > > >               WWN: 5006048ACAFE1E4C <-- end of record > > >               EST01_HB

Re: Q: how to push into array

2008-01-12 Thread ciwei
thanks for the reply. I was not able to figure out how the code works. I have commented the code below. can you help explain it a bit? thanks. On Jan 10, 9:41 am, [EMAIL PROTECTED] (Chas. Owens) wrote: > > __DATA__ > >              DEV01-HBA0_DMX1-13CA  <-- begin of record > >              

Re: Q: how to push into array

2008-01-10 Thread Chas. Owens
On Jan 10, 2008 4:28 PM, ciwei <[EMAIL PROTECTED]> wrote: > > > push @{ $wwn{ "$host-$hba" } }, /^\s+WWN:\s+(1000[0-9a-fA-F]{12})$/; > > Thanks for the help. > > can you please explain in the above line , what the { } around > push @{ $wwn ... } <--here do ? > > is the { } here optional? or can t

Re: Q: how to push into array

2008-01-10 Thread ciwei
> push @{ $wwn{ "$host-$hba"   } }, /^\s+WWN:\s+(1000[0-9a-fA-F]{12})$/; Thanks for the help. can you please explain in the above line , what the { } around push @{ $wwn ... } <--here do ? is the { } here optional? or can this be subsitute with ( )? thanks. -- To unsubscribe, e-mail: [EMAIL

Re: Q: how to push into array

2008-01-10 Thread Chas. Owens
On Jan 9, 2008 6:26 PM, ciwei <[EMAIL PROTECTED]> wrote: > Thanks for answering my question. > > I don't understand your second question, could you break your input > > into records so we can clearly see what how you want to define the > > records? > > My data looks like this: the rcord is variable

Re: Q: how to push into array

2008-01-10 Thread ciwei
Thanks for answering my question. > I don't understand your second question, could you break your input > into records so we can clearly see what how you want to define the > records? My data looks like this: the rcord is variable in the number of lines. I'm tring to push all WWN that start with 1

Re: Q: how to push into array

2008-01-09 Thread John W. Krahn
ciwei wrote: HI, a quetion from a newbie to perl. I have a program that extract some fields: #!/usr/bin/perl -w use strict; my ( $host, $hba, $storage, $fa ,$initiator , $target ) ; It appears that you don't really need those variables in file scope. my %wwn = (); while ( ) { next unles

Re: Q: how to push into array

2008-01-09 Thread Chas. Owens
On Jan 9, 2008 4:12 PM, ciwei <[EMAIL PROTECTED]> wrote: snip >push $wwn{$initiator}, $1 if /WWN:\s+(1000\d{12})/; >push $wwn{$target} , $1 if /WWN:\s+(500\d{13})/; snip > Type of arg 1 to push must be array (not hash elem) at ./ > emc_parse_switch_zone.pl line 20, near "$1 if"