CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate: Re: [FishMonger] Passing Arguments to perl script through HTML: Edit Log



karthikraju.n
Novice

Jan 6, 2014, 2:51 AM


Views: 3252
Re: [FishMonger] Passing Arguments to perl script through HTML

Hi, here is my perl script, would you please help us by develop same script using CGI.

Code
use Tie::File; 

my $dir = "\\\\xxx\\xxxx\\xxxxxxxxxx\\xxxxx\\xxxxxx\\file.txt";

my $groupName = $ARGV[0]; # passing arguments as > progname.pl Karthik ON
my $switch = $ARGV[1];
my $on = "on";
my $off = "off";

chomp($groupName);
chomp($switch);

if($switch eq $on)
{
tie @array, 'Tie::File', $dir or die "can't read open '$fp': $OS_ERROR";
for (@array)
{
if($_ =~ /^$groupName /)
{
print "\n\n\t Already ON!!\n";
last;
}
else
{
s/#$groupName /$groupName /g;
}
}
print "\nDONE\n";
}
elsif($switch eq $off)
{
tie @array, 'Tie::File', $dir or die "can't read open '$fp': $OS_ERROR";
for (@array)
{
if($_ =~ /^#$groupName /)
{
print "\n\n\t Already OFF!!\n";
last;
}
else
{
s/$groupName /#$groupName /g;
}
}
print "\nDONE\n";
}
else
{
print "\n Warning: Incorrect Input";
}



(This post was edited by FishMonger on Jan 6, 2014, 8:45 AM)


Edit Log:
Post edited by FishMonger (Veteran) on Jan 6, 2014, 8:45 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives