--- Wiggins d Anconia <[EMAIL PROTECTED]> wrote: [snip] > > _BEGIN_ > > #!/usr/bin/perl > > use warnings; > > use strict; > > Excellent start...
:) thank you [snip] > > for(my $i=0; $i < @lpstat; $i++){ > > $lpstat[$i] =~ /\w+\-(\d+)\s+(\w+)\s+/; > > $jobs{sprintf("d%05d-001",$1)} = $2; > > } > > This will work and is very Cesque, to make it more Perlish you might > consider a foreach loop, > > foreach my $job (@lpstat) { > $job =~ /...../; > blah blah blah... > } > > For me it is a bit more readable, but to each their own. :) i'm accustoming with perl :) sometimes foreach makes me confused :) [snip] > In the above line, as the error suggests 'keys' must take a hash as its > argument, $printers{jobs} is a scalar, so essentially you need to > dereference its value back into a hash, ending up with, > > foreach my $keys (keys %{ $printers{jobs} }) { [snip] Was that! Every time a hash reference is returned i need to derefence! Oh! god! Is this kind of reference like the C pointer, or something like this? > ... > > > print $printers{jobs}->{$key}."\n"; > > If you use $keys in the loop, then $key will throw a syntax error with > strict on, one should be plural the other shouldn't, which I was going > to suggest for readability anyways (aka make $key singular). [snip again] Wiggins, thank you very much! __________________________________ Do you Yahoo!? New and Improved Yahoo! Mail - 100MB free storage! http://promotions.yahoo.com/new_mail -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>