#! /usr/bin/perl
use strict;
use Getopt::Long;
my $OPT = {};
my ($version,$help_flag);
my $OPT=GetOptions(
"ver=s" =>\$version,
"help|h" =>\$help_flag
)or die "options parsing failed";
my %versions=(
r1=>"3DE4_linux64_r1" ,
r2b2=>"3DE4_linux64_r2b2" ,
r2=>"3DE4_linux64_r2",
r3b1=>"3DE4_linux64_r3b1");
print $versions{$version}?$versions{$version}:"$version is not a valid version string" , "\n";;
Thanks. But is there a way not to do it with a hard code list. That mean every time we get a new version I will have to update it. If I could just take the version then i would not have to update i
Sorry, of course you can, I need to look at the data more carefully
use Getopt::Long;
my $OPT = {};
my ($version,$help_flag);
my $OPT=GetOptions(
"ver=s" =>\$version,
"help|h" =>\$help_flag
)or die "options parsing failed";
my $appath="/opt/my/sfw/";
my $string="3DE4_linux64";
exec (-x "$appath/$string_$version")?("$appath/$string_$version"):("echo","$version is not a valid version string" );
# Get command-line options
Getopt::Long::config(qw( permute bundling ));
my ($version,$help_flag);
my $OPT = {};
GetOptions($OPT, qw(
"ver=s" =>\$version,
"help|h" =>\$help_flag
)) or die "options parsing failed";
if ($OPT->{help}) {
info();
exit(2);
}
but getting some errors
Possible attempt to separate words with commas at ./3DE line 73.
Error in option spec: ""ver=s""
Error in option spec: "=>\$version,"
Error in option spec: ""help|h""
Error in option spec: "=>\$help_flag"