tomsk
tomsk

Reputation: 997

Useless use of log in void context

What is wrong with this code?

I get an error: Useless use of log in void context at ./test.pl line 12.

#!/usr/bin/perl

use strict;
use warnings;

log();

sub log {
    print "Test";
    return;
}

Upvotes: 3

Views: 476

Answers (1)

toolic
toolic

Reputation: 62164

log is a built-in Perl function. One way to solve this is to rename your sub:

use strict;
use warnings;

mylog();

sub mylog {
    print "Test";
    return;
}

Upvotes: 7

Related Questions