You are not logged in.

#1 2014-07-16 15:22:03

publicus
Member
Registered: 2014-01-01
Posts: 129

[SOLVED]Perl n00b question about assigning values to variables in Perl

Hello, this is the piece of code that I'm working here:

#!/usr/bin/perl

use strict;
use warnings;

my ($config_file) = @ARGV;

my $master_config = "MASTER_config.txt"

if (defined $config_file)
{
  $master_config = $config_file;
}

print "The master config file is: $master_config\n\n";

When I run it, I get this error:

Global symbol "$master_config" requires explicit package name at command_line_arguments3.pl line 12.

I looked online, but I couldn't find an answer to my particular problem (and I'm fairly certain that I was looking in the wrong location as well.)

Any ideas why I'm getting this error?

[edit]

Ugh... I was missing a ';' at the end of line #8.  Having a more precise error message would be nice.

Last edited by publicus (2014-07-16 16:25:30)

Offline

Board footer

Powered by FluxBB