Ask a Question related to PERL Beginners, Design and Development.
-
Harshal borade #1
Problem using Getopts package
I am getting errors when I try to get command line
parameters.
For example this small code doesn't work on my
machine.
#########################################
#!/usr/bin/perl -w
use 'Getopt::Std';
getopt('de');
print "U have used d ", if $opt_d;
print "U have used e ", if $opt_e;
#########################################
The interpreter points out an error on the line "use
'Getopt::Std'"
__________________________________________________ ______________________
Yahoo! India Education Special: Study in the UK now.
Go to [url]http://in.specials.yahoo.com/index1.html[/url]
Harshal borade Guest
-
Getopts::std
I am using various switches in my script. I have the Getopts::std module and I wrote the following line: getopts('F:S:D:T:I:plen', \%OPTS); How... -
Again package problem!!!
I tried to package my publication but think CS has some problems with font copying! In ID 2.0 CE there wern't any problems with fonts. I noticed that... -
GetOpts: boolean and argument value combos
Hey Perl Peps, I am stuck in the mudd and hoping someone can give me a few clues that will help get me back on track. I want to submit some... -
Adobe picture package problem
When I try to print using picture package I get a pop up saying Could not complete picture package because of a command error or disc error. I think... -
Picture Package Problem!
Does anyone know how to reset the background defaults when you make a picture package in Photoshop 7.0? Mine was fine until recently and somehow I... -
Randy W. Sims #2
Re: Problem using Getopts package
On 02/11/04 06:33, Harshal Borade wrote:
You do not need to quote the module name in a use statement:> I am getting errors when I try to get command line
> parameters.
> For example this small code doesn't work on my
> machine.
> #########################################
> #!/usr/bin/perl -w
> use 'Getopt::Std';
>
> getopt('de');
> print "U have used d ", if $opt_d;
> print "U have used e ", if $opt_e;
> #########################################
>
>
> The interpreter points out an error on the line "use
> 'Getopt::Std'"
use Getopt::Std;
Regards,
Randy.
Randy W. Sims Guest
-
Randy W. Sims #3
Re: Problem using Getopts package
On 2/11/2004 9:23 AM, Wiggins d Anconia wrote:
unless it's in an eval ;-)> Actually we can emphasize that 'need' a bit to a 'cannot'. 'use' *must*
> take a bareword.
perl -Mstrict -we "my $m='Cwd';eval qq(use $m);print cwd();"
> perldoc -f use
>
> [url]http://danconia.org[/url]
>
Randy W. Sims Guest
-
R. Joseph Newton #4
Re: Problem using Getopts package
"Randy W. Sims" wrote:
Not really. In the example above, the module name is not quoted. The string> On 2/11/2004 9:23 AM, Wiggins d Anconia wrote:
>>> > Actually we can emphasize that 'need' a bit to a 'cannot'. 'use' *must*
> > take a bareword.
> unless it's in an eval ;-)
>
> perl -Mstrict -we "my $m='Cwd';eval qq(use $m);print cwd();"
constant to be substituted into the eval'ed expression is quoted:
my $m='Cwd'
as is necessay for a string assignment to a scalar.
The expression as a whole is double-quoted, as is required for nterpolated
strings offered for evaluation.
eval qq(use $m);
The module name, though, is not separately quoted. This is actually a simple
misuse of eval in void context for its side effects .The actual use statement
that gets processed is not quoted in any way.
Joseph
R. Joseph Newton Guest



Reply With Quote

