in reply to Not writing to file
It's not really worth using here... but it's nice to know it's there.#!/usr/local/bin/perl -w use strict; open(FILE, ">/tmp/blah") || die "Can Not Open File\n"; my $oldfh = select(FILE); # $oldfh stores the original filehandle # and FILE becomes the current filehandle # for output for (my $n = 1; $n < 10; $n ++) { # use backticks as noted elsewhere print `ping -c 1 192.168.1.$n`; } select($oldfh); # select the original filehandle, # just for neatness close (FILE);
- FrankG
Updated - changed system to print in for loop per Re: Re: Not writing to file
thanks to dws
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Not writing to file
by dws (Chancellor) on Apr 04, 2001 at 23:05 UTC | |
by how do i know if the string is regular expression (Initiate) on Apr 04, 2001 at 23:44 UTC |