T
tamiry
Hi,
I had some code in a module that won't compile. i narrowed down the
code to the miimu that won't compile. It looks like the division sign
confuses the switch statement. I'll be happy if someone could point the
problem(s).
i also noted that some minor changes make the problem disappear (i
wrote that at the bottom).
--------> my file:
#!/usr/bin/perl -w
use strict;
use warnings;
use Switch;
sub Function
{
my $self = shift;
my $num = $self->{ratio}/188;
while(1)
{
switch($self->{status})
{
case (0)
{
print "stt = 0\n";
}
}
}
}
sub Junction
{
my $self = shift;
my $num = $self->{ratio}/188;
}
------> end of my file
"fixes"
1. remove the entire switch statement.
2. remove the first division operation
3. remove the second division operation
4. add the "#/" (without the quotes) at the end of the line with the
first division
(replace
my $num = $self->{ratio}/188;
with
my $num = $self->{ratio}/188;#/
)
the error i get is:
syntax error at C:\Work\Perl\tst.pl line 17, near ")
{"
syntax error at C:\Work\Perl\tst.pl line 23, near "}"
Execution of C:\Work\Perl\tst.pl aborted due to compilation errors.
please help
thanks.
I had some code in a module that won't compile. i narrowed down the
code to the miimu that won't compile. It looks like the division sign
confuses the switch statement. I'll be happy if someone could point the
problem(s).
i also noted that some minor changes make the problem disappear (i
wrote that at the bottom).
--------> my file:
#!/usr/bin/perl -w
use strict;
use warnings;
use Switch;
sub Function
{
my $self = shift;
my $num = $self->{ratio}/188;
while(1)
{
switch($self->{status})
{
case (0)
{
print "stt = 0\n";
}
}
}
}
sub Junction
{
my $self = shift;
my $num = $self->{ratio}/188;
}
------> end of my file
"fixes"
1. remove the entire switch statement.
2. remove the first division operation
3. remove the second division operation
4. add the "#/" (without the quotes) at the end of the line with the
first division
(replace
my $num = $self->{ratio}/188;
with
my $num = $self->{ratio}/188;#/
)
the error i get is:
syntax error at C:\Work\Perl\tst.pl line 17, near ")
{"
syntax error at C:\Work\Perl\tst.pl line 23, near "}"
Execution of C:\Work\Perl\tst.pl aborted due to compilation errors.
please help
thanks.