every time i try to run my program (driver) is receive the following error message, arithmetic.pm did not return a true value at ./driver line 9, begin failed--compilation aborted at ./driver line 9
can anyone help me sort this out?
thank you very much

#!/usr/bin/perl -w
#Driver
#program by James Park
#last revision on friday, september 23rd.
#purpose this program driver will call on the arithmetic.pm file to find and use the correct #functions

use strict;
use lib ".";
use arithmetic;

sub menu{
print"please choose an option from the menu below:";
print"1. use the greatest common devisor function.";
print"2. use the least common multiple function.";
my $m = <STDIN>;
print"enter the first number: ";
my $a = <STDIN>;
print "enter the second number:";
my $b = <STDIN>;	
if ($m = 1 ){
	my $gcd;
	$gcd = arithmetic::gcd($a,$b);
	print "gcd of ($a,$b) = $gcd";
}else{
	my $lcm;	
	$lcm = arithmetic::lcm($a,$b); 
	print "lcm of ($a,$b)= $lcm";
}
}
#arithmetic.pm
#!/usr/bin/perl -w
use strict;
package arithmetic;

sub gcd() {
   my ($a, $b) = @_;
  ($a,$b) = ($b,$a) if $a > $b;
  while ($a) {
    ($a, $b) = ($b % $a, $a);
  }
  return $b;
}

sub lcm {
    my ($a,$b)=@_;
    return $a*$b/&gcd($a,$b);
}

]

I figured it out, I forgot to include the module return value at the end of arithmetic.
thanks anyway

every time i try to run my program (driver) is receive the following error message, arithmetic.pm did not return a true value at ./driver line 9, begin failed--compilation aborted at ./driver line 9
can anyone help me sort this out?
thank you very much

#!/usr/bin/perl -w
#Driver
#program by James Park
#last revision on friday, september 23rd.
#purpose this program driver will call on the arithmetic.pm file to find and use the correct #functions

use strict;
use lib ".";
use arithmetic;

sub menu{
print"please choose an option from the menu below:";
print"1. use the greatest common devisor function.";
print"2. use the least common multiple function.";
my $m = <STDIN>;
print"enter the first number: ";
my $a = <STDIN>;
print "enter the second number:";
my $b = <STDIN>;	
if ($m = 1 ){
	my $gcd;
	$gcd = arithmetic::gcd($a,$b);
	print "gcd of ($a,$b) = $gcd";
}else{
	my $lcm;	
	$lcm = arithmetic::lcm($a,$b); 
	print "lcm of ($a,$b)= $lcm";
}
}
#arithmetic.pm
#!/usr/bin/perl -w
use strict;
package arithmetic;

sub gcd() {
   my ($a, $b) = @_;
  ($a,$b) = ($b,$a) if $a > $b;
  while ($a) {
    ($a, $b) = ($b % $a, $a);
  }
  return $b;
}

sub lcm {
    my ($a,$b)=@_;
    return $a*$b/&gcd($a,$b);
}

]
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.