Re: using Perl grep to populate a scalar

2006-05-10 Thread Tom Phoenix
On 5/9/06, Smith, Derek <[EMAIL PROTECTED]> wrote: my (@key2,$value2) = 0; This statement is odd. It's making a new array with a single element (which element is zero). I think you mean something like this: my(@key2); my $value2 = 0; $key2[$value2++] = (grep /mirror/gi, `lvdis

RE: using Perl grep to populate a scalar

2006-05-10 Thread Smith, Derek
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tom Phoenix Sent: Wednesday, May 10, 2006 6:35 PM To: Smith, Derek Cc: Perl Beginners Subject: Re: using Perl grep to populate a scalar On 5/9/06, Smith, Derek <[EMAIL PROTECTED]> wrote: > if

Re: using Perl grep to populate a scalar

2006-05-10 Thread Tom Phoenix
On 5/9/06, Smith, Derek <[EMAIL PROTECTED]> wrote: if (/(?)vg00/) { That doesn't look right. Why is that question mark inside parentheses? If Perl doesn't complain about that pattern, maybe it should. Hope this helps! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL

RE: using Perl grep to populate a scalar

2006-05-10 Thread Smith, Derek
-Original Message- From: Smith, Derek Sent: Tuesday, May 09, 2006 5:22 PM To: Perl Beginners Subject: using Perl grep to populate a scalar All, I am trying to populate a scalar (ideally a hash) using a Perl grep but it is not working. I even tried to use an array and no data was

using Perl grep to populate a scalar

2006-05-09 Thread Smith, Derek
All, I am trying to populate a scalar (ideally a hash) using a Perl grep but it is not working. I even tried to use an array and no data was pushed. use strict; use warnings; my @lvs; my @lvaray = qx(bdf); foreach (@lvaray) { if (/(?)vg00/) { push @lvs, (split)[0] } }