in reply to Get an input file and print multiple output files after performing operations on array.
#! perl -slw use strict; my @city = split ' ', <DATA>; my @temp = split ' ', <DATA>; my @note = split ' ', <DATA>; my $i = '01'; for my $city ( @city ) { for my $temp ( @temp ) { for my $note ( @note ) { open O, '>', 'out' . $i++ or die $!; print O 'city: ', $city; print O 'weather: ', $temp; print O 'recommended: ', $note; close O; } } } __DATA__ Jakarta paris delhi singapore hot cold wet yes no cannotcomment
Output:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Get an input file and print multiple output files after performing operations on array.
by Ganesh Bharadwaj1 (Sexton) on Dec 29, 2015 at 06:36 UTC |