in reply to Perl is ignoring fractional part sometimes

hi, remove all tk stuff from your program, and just give calc() various inputs and watch what output you get

  • Comment on Re: Perl is ignoring fractional part sometimes

Replies are listed 'Best First'.
Re^2: Perl is ignoring fractional part sometimes
by jinnicky (Sexton) on Jul 17, 2016 at 23:38 UTC

    As expected, this works

    #!/usr/bin/perl -w use strict; my $x = 12; my $y = 14; my $scale = '22.5'; my ($xmax,$ymax,$input); calc(); while(1) { print "Enter X,Y,Scale: "; $input = <>; chomp $input; last if $input =~ m/^\s*$/; ($x,$y,$scale) = split(/\s*,\s*/,$input); calc(); } sub calc { $xmax = $x * $scale; $ymax = $y * $scale; print "$x, $y, $scale, $xmax, $ymax\n"; }

    So it's something that Tk is doing to cause the problem