Perl code: use strict;
use Getopt::Long;
my ($tenant, $output);
GetOptions ("t=s" => \$tenant, "o=s" => \$output);
&usage() if (!defined($tenant) || !defined($output));
$tenant=~/(\w)(\w+)$/;
my $first = uc($1);
my $rest = $2;
my $password="Export-${first}${rest}!";
I want above code to change into ruby. I am new to ruby can somebody help me please
Ruby code which i wrote: require 'optparse' options = { :t => $tenant, :o => $output}
ARGV[0]=options("#{$tenant}")
ARGV[1]=optionsi("#{$output}")
optparse = OptionParser.new do|opts|
end
opts.parse! ARGV[0]
opts.parse! ARGV[1]
$tenant=('/\p{Alnum}/')
$first = $TENANT.slice(0,1).capitalize
$second =$TENANT.slice(1..-1)
PASSWORD="Export-"+ $first + $second.chomp + "!"
can you please explain it
Aucun commentaire:
Enregistrer un commentaire