in reply to Syntax errors in setting path..

Use concatenation...
#!/usr/bin/perl use strict; my %options; $options{'v'} =~s/\/\.\.\.//; my $optv_modem = $options{'v'} . "/modem/..."; print "\n$optv_modem\n"; my $optv_apps = $options{'v'} . "/apps/..."; print "\n$optv_apps\n";

Replies are listed 'Best First'.
Re^2: Syntax errors in setting path..
by Anonymous Monk on Mar 12, 2011 at 07:37 UTC
    Thanks.Also I just want to use 'msm' as an option,no value should be entered for it,how do I make sure that option msm is given but there should be no value.Will the following work?how to make the options case-insensitive?Thanks
    use Getopt::Long; #Getting the command-line options my %options = (); GetOptions (\%options,'msm','des=s', 'a=s', 'd=s', 'r=i', 'v=s'); if($options(msm)){....}
      Make msm a flag...
      #!/usr/bin/perl use strict; use warnings; use Getopt::Long; my $string = 'string'; my $length = 'length'; my $msm = 'msm'; my $result = GetOptions ('des=s' => \$string, 'a=s' => \$string, 'd=s' => \$string, 'r=i' => \$length, 'v=s' => \$string, 'msm' => \$msm);
      Or simply my $msm;
Re^2: Syntax errors in setting path..
by Anonymous Monk on Mar 12, 2011 at 07:50 UTC
    Thanks.Also I just want to use 'msm' as an option,no value should be entered for it,how do I make sure that option msm is given but there should be no value.Will the following work?how to make the options case-insensitive?Thanks Update:Ignore the query but i would like to know how to I stop on an unknown option given?
    use Getopt::Long; #Getting the command-line options my %options = (); GetOptions (\%options,'msm','des=s', 'a=s', 'd=s', 'r=i', 'v=s'); if($options(msm)){....}
Re^2: Syntax errors in setting path..
by Anonymous Monk on Mar 12, 2011 at 07:50 UTC
    Thanks.Also i would like to know how to I stop on an unknown option given?
    use Getopt::Long; #Getting the command-line options my %options = (); GetOptions (\%options,'msm','des=s', 'a=s', 'd=s', 'r=i', 'v=s'); if($options(msm)){....}
      GetOptions displays an error message and returns false when it encounters an unrecognised option.
Re^2: Syntax errors in setting path..
by AnomalousMonk (Archbishop) on Mar 13, 2011 at 00:00 UTC

    ... or interpolation.

    >perl -wMstrict -le "my %options = qw(v foo/...); $options{'v'} =~ s{ /\.\.\. }{}xms; my $optv_modem = qq{$options{'v'}/modem/...}; print qq{'$optv_modem'}; " 'foo/modem/...'