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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

printing problem

Status
Not open for further replies.

mama12

Programmer
Oct 18, 2005
22
NL
HI,

I want to delete or I dot not want to print number 0 and 100.
what I have to get is all numbers between -100 and 100,exclusive number 0 and 100.

what I did is like that

$x = 0,100;
$y = $count -$x;

regards
----------------------------------
#!/usr/bin/perl -w

print "give a file name: ";
$fname = <STDIN>;
open FH, ">$fname" or die "Cant open File $!";
$x = 0,100;
$y = $count -$x;
# with a for loop
for ( my $count= -100; $count<=100; $count++ ) {
print $count,"\n";
print FH $y,"\n";
}
close FH;
 
you did ... fair play... tock tick
must run that ... oneday ... this your card .....

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
well, seems obvious enough, use two loops:

Code:
for (-100..-1) {
  print $_,"\n";
  print FH $_,"\n";
}
for (1..99) {
  print $_,"\n";
  print FH $_,"\n";
}


(still trying to figure out what Paul is saying, looks like DaVinci code maybe....)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top