mikejones has asked for the wisdom of the Perl Monks concerning the following question:
I want to place this one string into two vars. Then i will compare these vars to a list of strings using __DATA__
So I'd like to see from Dumper VAR1 and VAR2?
thank you!
sample data from OS command: root@dxxxxx:/export/resources/SOX/scripts> fcstat fcs0|grep -i node |c +ut -f2 -d: 0x20000000C95C0379 __OUTPUT__ $VAR1 = ' 0x20000000C95A58AE '; $VAR1 = ' 0x20000000C95C0379 '; __CODE__ use strict; use warnings; use Data::Dumper; my @hbas; open (LSDEV, "/usr/sbin/lsdev |") or die $!; while (<LSDEV>) { if ( /^(fcs\d+)/ ) { push (@hbas, +(split)[0]); } } my %hoh; for my $hba (@hbas) { $hoh{$hba} = qx(/usr/bin/fcstat $hba|/usr/bin/grep -i node|/usr/bin/cut -f2 +-d:); } while (my ($key, $val) = each %hoh) { #print "$key =>\n\t$val\n"; #print "\n"; $\ = "\n"; print Dumper($val); my $str = split /\s+/, $val; print $str; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: two vars from one string.
by ikegami (Patriarch) on Mar 02, 2010 at 22:23 UTC | |
by mikejones (Scribe) on Mar 03, 2010 at 16:24 UTC | |
by ikegami (Patriarch) on Mar 03, 2010 at 18:27 UTC | |
by mikejones (Scribe) on Mar 03, 2010 at 21:21 UTC | |
by ikegami (Patriarch) on Mar 03, 2010 at 21:37 UTC |