On 12-06-21 07:41 AM, Shlomi Fish wrote:
Hi Balli,
On Mon, 18 Jun 2012 23:23:19 -0700 (PDT)
balli sudan<sudan.ba...@gmail.com> wrote:
####this is my sample code friends###
sub swap
{
($rule1,$rule2=@_;
my $old_rule="iptables -A INPUT -s 0/0 -i eth0 -d 192.168.2.1 -p TCP -j ACCEPT";
$temp = $old_rule;
my $new_str=iptables -D INPUT rule_no
#now here we will add the desired rule number
my $new_rule=iptables -I INPUT rulenumber-s 202.96.0.0/12 -j DROP
$old_str=$new_str
$new_str = $temp
# if we have to swap rules we will simply delete the previous rule in the chain
and add a new rule
This code is invalid and won't compile. Where is your real code?
For how to write code properly see:
http://perl-begin.org/tutorials/bad-elements/
In order to swap the contents of two variables in Perl, you can simple do:
($x, $y) = ($y, $x);
No need for temporary variables.
sub swap {
return reverse @_;
}
--
Just my 0.00000002 million dollars worth,
Shawn
Programming is as much about organization and communication
as it is about coding.
_Perl links_
official site : http://www.perl.org/
beginners' help : http://learn.perl.org/faq/beginners.html
advance help : http://perlmonks.org/
documentation : http://perldoc.perl.org/
news : http://perlsphere.net/
repository : http://www.cpan.org/
blog : http://blogs.perl.org/
regional groups : http://www.pm.org/
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/