Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble printing to file

Status
Not open for further replies.

bluedragon2

IS-IT--Management
Joined
Jan 24, 2003
Messages
2,642
Location
US
I have the following code that will print to the screen, but not to the OUTTEMP file. It creates the file, but will not print to it. Where am I going wrong :)

#!/opt/thirdParty/perl/bin/perl

open (IN,"/opt/chknodes/nodelist.txt");
open (OUTTEMP,">/opt/chknodes/alivenodes.out");

foreach $node (<IN>) {
@nodebit = split(/ /,$node);
$p = `ping $nodebit[0]`;
@bits=split(/ /,$p);
if ($bits[0] eq $nodebit[0]) {
print OUTTEMP $nodebit[6];
print $nodebit[6];
}
}

close (OUT);
close(IN);


[Blue]Blue[/Blue] [Dragon]

If I wasn't Blue, I would just be a Dragon...
 
found the problem, another typo

[Blue]Blue[/Blue] [Dragon]

If I wasn't Blue, I would just be a Dragon...
 
'strict' and 'warnings' and 'diagnostics' are all good modules/pragmas to use.



------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top