Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

while (my ($key, $value) = each(%ENV)) {
print "$key - $value\n";
}
What does the above sample code produce?

What function do you use for reading a list of files within
a directory?

my %hash = (
'hi' => {'hello' => 'all'},
'bye' => {'later' => 'gone'}
);

print $hash{'hi'};
What is printed when the above code is executed?


sub new {
my $pkg = shift;

my $test = {'name' => shift;};
????
return $test;
}
Which one of the following replaces "????" in the above
code in order to cause the function new to return an object
of type "Test"?


while (<STDIN>) {
????
print "$_\n";
}
Which one of the following statements causes the above
code to strip all whitespace from the end of all lines of
input and to print the resulting lines to standard output

while (my ($key,$value) = each(%hash)) {
print "$key - $value\n";
delete $hash{$key};
}


open(FILE,"<file.dat");
my $data = '';
{ local $/ = undef;
$data = <FILE>;
}
close(FILE);


my $foo = 21;
$foo <<= 5;
$foo >>= 4;

print $foo;

@arr = (1,2,3);
{local $" = "\n";
print "@arr\n";
}

my $line = "Hello World";
substr($line,5,2) = "abc";
print $line;

Why is sprintf rarely used in perl in comparison to similar
(or the same) functions in other languages?


my $subRef = sub {print shift;};
How is the subroutine above called with one parameter?


How can the values of an associative array be placed in
sorted order in a new array?

What function is often necessary for building data
structures to be passed to low-level routines such as ioctl
and fcntl?

sub foo {
if (shift(@_) > 0) {
shift;
}
}

print foo(10,5);
print foo(-10,5);
What does the above sample

for (my $i = 1; $i <= 3; $i++) {
print 1..$i;
print "\n";
}

my $data = 5**3 * 12,2+2;
print $data;


sub foo {
my $value = shift;
if ($value) {
print 1;
shift;
}
else {
return shift(@_) + 3;
}
}

print foo(10,20);
What is printed as the result of executing the above
code?


$var = 20;
sub s1 { print "$var "; }
sub s2 { local $var = 10; s1;}
sub s3 { my $var = 30; s1;}

s3;
s2;
s1;

On systems that record file ownership, how may the owner of
a file be identified?

Which one of the following sets $y to be a copy of $x with
every occurrence of foo changed to bar?


Which one of the following is an array literal that
represents a 4-element array containing the numbers 1, 4,
2, and 6?


sub foo {2*shift || 'x';}

printf ("%s %s %s", foo(5),foo(0),foo(-5));
What does the above sample code print?


Suppose $x contains a number. Which one of the following
statements sets $y to be a string containing the octal
value of $x?

Answer Posted / arun

while (my ($key, $value) = each(%ENV)) {
print "$key - $value\n";
}
What does the above sample code produce?
ans:
it list all the ENV variables as key-value

2.What function do you use for reading a list of files within
a directory?
ans: open(Dir,< "dirname")and in a loop use 'read Dir' function,

3.my %hash = (
'hi' => {'hello' => 'all'},
'bye' => {'later' => 'gone'}
);

print $hash{'hi'};
What is printed when the above code is executed?
Ans:it prints the Hash address HASH(2324234).

will answer rest when i find time,
thanks
Arun

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the features of perl language?

1068


I have one question regarding to eval function. I know eval function is use for error checking but I am not able to understand below line. eval \'exec perl -S $0 ${1+\"$@\"}\' if 0; $0 for script name $@ set if error occur

2029


Hi, I am a accountant. I am preparing a balance sheet but because of staff shortage and time pressures I cant complete it on time. There is lot of common data with last years which I need not retype and I can manage by editing last year’s balance sheet ? Is their any software on net where I can do this easily??

2136


Which functions in perl allows you to include a module file. State their differences.

932


Create a function that is only available inside the scope where it is defined ?

980


What does `new $cur->{LINK}' do? (Assume the current package has no new() function of its own.)

928


how to create a flat file database as shown below s.no name age city phone 0 hema 22 Calcutta 4312542 1 hema 21 Bangalore 2344345 2 ganesh 25 delhi 2445454 3 kartik 45 pune 4312121 4 santosh 25 Hyderabad 2254231 5 kumar 25 mysore 2344567 6 gita 34 mangalore 6532123 7 gita 32 pune 2213456 Q1.print the details of the person who r from bangalore q2.Replace the city name managlore to pune q3.prints no of person having name gita and hema q4.print how many are of age 25.

2046


How do I sort a hash by the hash key?

912


Why we use CGI?

2525


You want to download the contents of a url with perl. How would you do that?

867


Why to use perl?

932


What does the’$_’ symbol mean?

990


What interface used in PERL to connect to database? How do you connect to database in Perl?

972


Explain perl. When do you use perl for programming?

861


Explain ivalue in perl?

968