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/;
In reply to Re: Cool Archlinux network script
by jwkrahn
in thread Cool Archlinux network script
by heatblazer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |