Desmond Lim <[EMAIL PROTECTED]> wrote: : : I have 3 arrays @arr1, @arr2 and @arr3. : : I need to print them into the same file and I'm doing this. : : open FILE, <file name>; : print FILE "@arr1\n"; : print FILE "@arr2\n"; : print FILE "@arr3\n"; : close FILE; : : I would like to shorten it to : : for ($i=0;$i<4;$i++) { : print FILE "@arr$i\n"; : } How about:
use strict; use warnings; my $filename = 'blah'; # always check to see if open succeeded open FH, $filename or die "Cannot open $filename: $!"; print FH "@[EMAIL PROTECTED]@arr3\n"; close FH; __END__ HTH, Charles K. Clarkson -- Head Bottle Washer, Clarkson Energy Homes, Inc. Mobile Home Specialists 254 968-8328 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]