Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I resolve this case of 'Useless use of a variable in a void context'?

How can I resolve this case of 'Useless use of a variable in a void context'? (line 17)

sub next {
    my $page = shift;

    my $next_stage = $page->{tree}->{nextstage};
    my $prev_stage = $page->{stage};

    print "Moving from: $prev_stage to $next_stage.\n" if ($DEBUG);

    if ($next_stage eq "end") {
        serialize_grabber_conf_answers($page, $config_file_tmp);
        $grabber_initialized = 1;
        return FALSE;
    }

    unless (defined ($page->{next_page})) {
        serialize_grabber_conf_answers($page, $config_file_tmp);
        my $next_page = ($page, $config_file_tmp, $next_stage);
        $next_page->{stage} = $next_stage;
        $page->{next_page} = $next_page;
        $next_page->{prev_page} = $page;
    }

    return FALSE;
    }

Thanks

like image 519
user1091187 Avatar asked Jan 04 '12 14:01

user1091187


1 Answers

The problematic line is

my $next_page = ($page, $config_file_tmp, $next_stage);

You are assigning to a scalar, so only the last member of the list will be used. The previous members are thrown away - useless use of a variable.

like image 189
choroba Avatar answered Oct 27 '22 21:10

choroba