sparkyfishcake has asked for the wisdom of the Perl Monks concerning the following question:
Edited by castaway - added code tags .#!/usr/bin/perl -w open (HOSTLIST, hosts"); while ($host = <HOSTLIST>) { chomp ($host); #foreach $host ( 'hosta','hostb' ) { print "$host\n"; open (INQ_ET, "$host"); $, = ' '; # set output field separator $\ = "\n"; # set output record separator foreach (<INQ_ET>) { if (/\/dev/) { s/://g; ($Fld1,$Fld2,$Fld3,$Fld4,$Fld5,$Fld6) = split(' ', $_, 9999); printf ("'%s','%s','%s','%s','%s'\n", $Fld1, $Fld2, $Fld3, $Fld +6, $host); } } close (INQ_ET); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: open and closing filehandles within a loop
by Zaxo (Archbishop) on Oct 28, 2003 at 06:15 UTC | |
by Anonymous Monk on Oct 28, 2003 at 18:45 UTC | |
|
Re: open and closing filehandles within a loop
by pg (Canon) on Oct 28, 2003 at 06:14 UTC |