G
grocery_stocker
Tad said:How was using & screwing him up?
Okay, this is late at night. I need to cook dinner and such. Here is
the best thing my minimum wage mind can came up with in terms of having
& screw himself. Say I modify the code such that:
#!/usr/bin/perl
use warnings;
#test value;
my $email = "cdalten\@eecs\.berkeley\.edu";
my $screw = "la";
sub valid_address($){
my ($addr) = @_;
my ($domain, $name, $valid);
($name, $domain) = (split/@/,$addr);
$valid = 0;
#yes I know I should used fork()/exec;
system("nslookup $domain");
}
&valid_address($email, $screw);
Notice that the number of arguments passed the function don't match.
I'm sure you could imagine someone accidently passing more args to the
function that necessary. When I run the code, I get
miss_xtc@linux:~/perl> ./val.pl
Note: nslookup is deprecated and may be removed from future releases.
Consider using the `dig' or `host' programs instead. Run nslookup with
the `-sil[ent]' option to prevent this message from appearing.
Server: 63.93.96.20
Address: 63.93.96.20#53
Non-authoritative answer:
Name: eecs.berkeley.edu
Address: 169.229.60.27
Name: eecs.berkeley.edu
Address: 169.229.60.161
The computer lets this code pass.
Now I remove the & from valid_address
#!/usr/bin/perl
use warnings;
#test value;
my $email = "cdalten\@eecs\.berkeley\.edu";
my $screw = "la";
sub valid_address($){
my ($addr) = @_;
my ($domain, $name, $valid);
($name, $domain) = (split/@/,$addr);
$valid = 0;
#yes I know I should used fork()/exec;
system("nslookup $domain");
}
#note, no & thingy.
valid_address($email, $screw);
Now, when I run the code, I get
miss_xtc@linux:~/perl> ./val.pl
Too many arguments for main::valid_address at ./val.pl line 18, near
"$screw)"
Execution of ./val.pl aborted due to compilation errors.
Look, it won't pass. Maybe another time I'll take up more one the whole
system() thingy. Did I miss the point? Look at me from the side, does
the dress make my ass look big?