I must be just a goober, but I can't seem to figure out how to use the variables from a module while using use strict;
I have this snippet of code:
#!/usr/bin/perl -w use strict; use Getopt::Std; getopts('hd:t'); my ($num_days, $dait, $today); # local vars used later my ($opt_h, $opt_d); # vars from Getopt::Std # if I don't use my() here I get the following #Global symbol "$opt_h" requires explicit package name at ./checklogs. +pl line 12. #Global symbol "$opt_d" requires explicit package name at ./checklogs. +pl line 13. # I tried Getopt::Std::$opt_h and it didn't like it either. # if ( $opt_d ) { $num_days = $opt_d; } print ("num_days = $num_days\n");
$opt_d never gets initialized when I use my(); I'm assuming that it is creating the variable locally and not from the package. How do I get the variables from the package Getopt::Std into my program?
Any help would be greatly appreciated.In reply to how do i use module vars while using use strict; ? by L8on
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |