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" > Execution of ./emc_parse_switch_zone.pl aborted due to compilation > errors. > > so my questions: > 1. what is wrong with push here? > 2. how to properly determine the boundaris of the records. each > record ending with the last "WWN: " lnes. snip
The push function expects an array not an arrayref, so if you want to use an arrayref you must first dereference it: push @{$wwn{$initiator}}, $1 if /WWN:\s+(1000\d{12})/; push @{$wwn{$target}} , $1 if /WWN:\s+(500\d{13})/; 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? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/