in reply to How to process Getopt::Long from STDIN

Speaking from some experience before any real thought, there are a couple of ways you may be able to do this, depending on what's actually going on in your code. So, with that said, it'd help if you could show the code that presents this problem (a small, but fully working example that demonstrates and duplicates the issue at hand).

  • Comment on Re: How to process Getopt::Long from STDIN

Replies are listed 'Best First'.
Re^2: How to process Getopt::Long from STDIN
by m_jaser (Novice) on Mar 12, 2017 at 03:20 UTC

    Thanks for your quick response...! Here's what the first part of the code looks like:

    my ( $Carrier_Option, $printHelp, $version, $Nr_of_TP, $is_BS, $my_legend, $curr_dir, ); GetOptions( "c|C|carriers=s"=>\$Carrier_Option, #string "t|T|TP=i"=>\$Nr_of_TP, #numeric "h|H|Help"=>\$printHelp, #boolean "v|V|Version"=>\$version, #boolean "b|B|BS|bs|Bs"=>\$is_BS, #boolean "l|l|legend=s"=>\$my_legend, #string "a|A|altitude=i"=>\$BS_RadioHeight, "d|D|Directory=s"=>\$curr_dir, );

    I run the script at first as follows:

    perl Analyzer.pl -t 2 -c "4 1 2 3 4"

    If the options are not entered, then default settings are considered in the script's execution, and the active directory is taken from the current local working directory. The second part of the script (which is where i need the help) is still not complete, but my plan is to have something as follows:

    print "To process another log file, enter the path to the log file alo +ng with the options, or enter 'x' to exit: "; my $New_User_Input=<STDIN>; chomp $New_User_Input; my $new_options=GetOptionsFromString($New_User_Input);

    I'm not sure how this works with GetOptionsFromString perhaps?? or some other method?

    I hope this makes it a little clearer to what I intend to do.

    Thanks...!