Re: [PLUG] perl question

2012-03-05 Thread Michael R
another way to approach it, with a bit of sanity checking. #!/usr/bin/perl use strict; use warnings; use diagnostics; my %valid_cpus =  ( cpu_all => 1); open my $t, ">>", "cpu_all.log" or die "bletch"; $valid_cpus{cpu_all} = $t; # 0 .. 7 just my example. for my $i  ( 0 .. 7 ) {     my $fname

Re: [PLUG] perl question

2012-03-05 Thread Pete Lancashire
I figured it out $item2save{'cpu01'} = IO::File->new("> cpu01.out"); $item2save{'cpu02'} = IO::File->new("> cpu02.out"); $item2save{'cpu03'} = IO::File->new("> cpu03.out"); ... print { $item2save{ $itemfound } } where $itemfound can have the values that match the keys in the %item2save hash

Re: [PLUG] perl question

2012-03-05 Thread Benjamin Foote
#!/usr/bin/perl use strict; use warnings; my $logfile = $ARGV[0]; open (LOG, $logfile) or die "can't open $logfile: " . $!; while (my $line = ) { chomp($line); my @cols = split /\s+/, $line; my $cpufile = shift @cols; open (OUT, ">> " . $file") or die "can't open $cpufile: " . $!;

[PLUG] perl question

2012-03-05 Thread Pete Lancashire
my brain this morning is blocked on this one I have a data file cpu01 value value value cpu02 value value value cpu03 value value value ... cpu01 value value value cpu02 value value value cpu03 value value value ... cpu01 value value value cpu02 value value value cpu03 value value value

Re: [PLUG] perl question

2009-05-29 Thread Joe Pruett
> I'm at a loss about why this simple concatenation is not working. I'm > pulling a value from a hash and attempting to concatenate ".cal" on the end. > > >$Cal_ref = { >'cal_name' => $cal_name, >'dates' => \...@dates, >'desc'=> $cal_desc >

[PLUG] perl question

2009-05-29 Thread Daniel Herrington
All, I'm at a loss about why this simple concatenation is not working. I'm pulling a value from a hash and attempting to concatenate ".cal" on the end. $Cal_ref = { 'cal_name' => $cal_name, 'dates' => \...@dates, 'desc'=> $cal_desc };