RE: Question on referencing
Thanks to the list. I understood that it was a reference, but could not get it through the thick skull. I really appreciate this list and how quickly an answer will come. Have a great day! Wags ;) application/ms-tnef
Re: Question on referencing
Wagner-David wrote: >my $sauditt = backtick("Type $qvmin"); >$auditt = $sauditt; >$sauditt = backtick("Type $qvmdata"); >$auditt .= $sauditt; > >foreach ( @$auditt ) { > printf "$_\n"; > } $auditt and $sauditt are array references, so don't use the '.' concatenation operator which is for strings. You can't combine 2 different arrays by their references (at least, not without dereferencing them). Here's some code to chew on.. my $auditt = backtick("Type $qvmin"); my $sauditt = backtick("Type $qvmdata"); print "$_\n" foreach (@$auditt, @$sauditt); --or-- print map { "$_\n" } @{ backtick("Type $qvmin") }, @{ backtick("Type $qvmdata") }; --- You are currently subscribed to perl-win32-users as: [archive@jab.org] To unsubscribe, forward this message to [EMAIL PROTECTED] For non-automated Mailing List support, send email to [EMAIL PROTECTED]
Re: Question on referencing
Wagner-David wrote: > > I have the following snippet of code: > >my $auditt = backtick("Type $qvmin"); >foreach ( @$auditt ) { > printf "$_\n"; > } > This will print out what I expect. > > Now I want to do two actions and then print it out and I know that I > am doing it wrong, but unsure what the following code should be to get the > output of both "type " to print within one foreach? Or how do I bring > together the output. >my $sauditt = backtick("Type $qvmin"); >$auditt = $sauditt; >$sauditt = backtick("Type $qvmdata"); >$auditt .= $sauditt; > >foreach ( @$auditt ) { > printf "$_\n"; > } > > Sorry if not clear, but unsure how to ask the question? One approached would be to use a hash of lists: my %hol = (); my @keys = qw($qvmin $qvdata); foreach (@keys) { $hol{$_} = backtick("Type $_"); } // now print out the results foreach (@keys) { print "$_: \n"; print(join("\n\t", @{$hol{$_}})); } Ian -- 99 little bugs in the code, 99 bugs in the code. Fix one bug, compile again, 100 little bugs in the code. 100 little bugs in the code, 100 bugs in the code. Fix one bug, compile again, 101 little bugs in the code... --- You are currently subscribed to perl-win32-users as: [archive@jab.org] To unsubscribe, forward this message to [EMAIL PROTECTED] For non-automated Mailing List support, send email to [EMAIL PROTECTED]
Re: Question on referencing
On 05/24/00, "Wagner-David <[EMAIL PROTECTED]>" wrote: > This message is in MIME format. Since your mail reader does not understand > this format, some or all of this message may not be legible. > > --_=_NextPart_000_01BFC5BE.672E2A00 > Content-Type: text/plain; > charset="iso-8859-1" Next time try to post in plain text. >my $sauditt = backtick("Type $qvmin"); >$auditt = $sauditt; >$sauditt = backtick("Type $qvmdata"); >$auditt .= $sauditt; > >foreach ( @$auditt ) { If $auditt is an array reference, then '.=' is the wrong operator ('.' is for string concatenation). You could just say: foreach (@$auditt, @$sauditt) { Or if you really need one array ref which includes both arrays, you could say: $auditt = [@$auditt, @$sauditt]; HTH, Douglas Wilson --- You are currently subscribed to perl-win32-users as: [archive@jab.org] To unsubscribe, forward this message to [EMAIL PROTECTED] For non-automated Mailing List support, send email to [EMAIL PROTECTED]