in reply to Cool Archlinux network script
return $inp or "";
Because of the low precedence of the or operator that will not do what you seem to think it will:
$ perl -le' sub prompt { my $inp = shift; return $inp or "zzz"; } print prompt( $_ ) for undef, 0, 1, 2; ' 0 1 2
You need to use the higher precedence || operator:
$ perl -le' sub prompt { my $inp = shift; return $inp || "zzz"; } print prompt( $_ ) for undef, 0, 1, 2; ' zzz zzz 1 2
while ( chomp(my $inpt = <STDIN>) != 0 ) {
That is usually written as:
while ( my $inpt = <STDIN> ) { chomp $inpt;
system("ifconfig wlan0 up") if ( (my $ifconf = `ifconfig`) + !~ /wlan0/ );
You never use the $ifconf variable anywhere else in your program so why are you creating it? Just do:
system 'ifconfig wlan0 up' if `ifconfig` !~ /wlan0/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Cool Archlinux network script
by heatblazer (Scribe) on May 26, 2012 at 10:17 UTC | |
|
Re^2: Cool Archlinux network script
by heatblazer (Scribe) on May 31, 2012 at 18:55 UTC |