Hi all,

I think I am using the term (Type-globbing) correctly but we will see...

I have a program I am making that needs to read lines from a file. Here is a 
snip of code to show what I'm doing...

#/usr/bin/perl

use strict;
use warnings;

my (%User_Preferences, $var, $value);

--<snip>--

open (CFG, "/etc/backup.conf") or die "Can't open config file: $!\n";
  while (<CFG>) {
    chomp;
    s/#.*//;
    s/^\s_//;
    s/\s+$//;
    next unless length;
   ($var, $value) = split(/\s*=\s*/, $_, 2);
    $User_Preferences{$var} = $value;
  }
close CFG;

(More code that isnt important)

--<END>--

Ok so when I run my program like this .. it complains on the the open() line 
and the close() line. It says:

Bareword "CFG" not allowed while "strict subs" in use at backup-client.pl line 
27.
Bareword "CFG" not allowed while "strict subs" in use at backup-client.pl line 
37.

But ... if I change the CFG to *CFG only in the open and close lines, then it 
looks like it works. If I recall correctly, I should have to put the * in front 
of the filehandle, I dont remember having to do that in the past.

I guess I'm looking more for an explanation of the reasoning unless I am doing 
something syntactically(sp) wrong.

Thanks in advance for the help and comments,

Dave Kettmann
NetLogic
314-266-4000

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to