A
Alexander Jack
I came across this question in my office ,Im having my own idea
regarding this , so please tell your views and explanation if
possible
#! /usr/local/bin/perl -Tw
sub foo {
my $data = shift;
if ($data =~ /^([-\w.]*)$/) {
return $1;
} else {
die "Bad data in $data\n";
}
}
my $line = <STDIN>;
$line = foo($line);
Question: When is code similar to the above code used in a perl
program ?
Choices:
a. When most data is required as a scalar
b. When running setuid perl scripts that must securely use user-
supplied data
c. When preparing a function that will eventually check data for
specific criteria
d. When wanting to have a function return a string form of a parameter
e. When any string data must contain at least one character
regarding this , so please tell your views and explanation if
possible
#! /usr/local/bin/perl -Tw
sub foo {
my $data = shift;
if ($data =~ /^([-\w.]*)$/) {
return $1;
} else {
die "Bad data in $data\n";
}
}
my $line = <STDIN>;
$line = foo($line);
Question: When is code similar to the above code used in a perl
program ?
Choices:
a. When most data is required as a scalar
b. When running setuid perl scripts that must securely use user-
supplied data
c. When preparing a function that will eventually check data for
specific criteria
d. When wanting to have a function return a string form of a parameter
e. When any string data must contain at least one character