Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

marto's scratchpad

by marto (Chancellor)
on Jun 02, 2004 at 07:58 UTC ( #359256=scratchpad: print w/ replies, xml ) Need Help??

For To_bz:

#!/usr/bin/perl use strict; use warnings; # here you assign the value "index_out" to $Index_File_Name my $Index_File_Name = "index_out"; warn "Index_File_Name: $Index_File_Name"; # here you assign an undefined value to $Index_File_name # it no longer contains what you think it does. $Index_File_Name = shift; warn "Index_File_Name: $Index_File_Name";

Just get rid of the line $Index_File_Name = shift;. See shift or if you want to have a default output file name if the user does not specify one via the command prompt:

#!/usr/bin/perl use strict; use warnings; my $Index_File_Name = shift || "index_out"; warn "Index_File_Name: $Index_File_Name";

If you run this code the first argument will be the file name, if none is provide "index_out" will be the file name.

I've sent a pull request on github to improve the error message returned. On this site we use code tags when posting so that code and data are readable:

<code> Your code goes here </code>

The following are worth reading: PerlMonks for the Absolute Beginner, How do I post a question effectively?.

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2014-07-31 22:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (255 votes), past polls