Perl Programming
Test your knowledge of Perl programming language including functions, operators, string manipulation, arrays, hashes, subroutines, and object-oriented features.
Questions
$string = "good food"; $string =~ s/o*/e/;print $string;
- geod food
- geed food
- geed feed
- egood food
Which Operator can be used in sort function for sorting array elements numerically?
- <>
- >
- <=>
- cmp
Which variable stores the parameters passed to subroutine?
- $@
- @
- @_
- $#
To repeat the iteration of loop we will use following statement ?
- next
- repeat
- recall
- redo
In perl ,if $variable="10" then what will output of print 'this is $variable'; ?
- this is $10
- this is $variable
- this is
- this is 10
How to check version of perl on your machine ?
- perl -b
- perl -version
- perl -c
- perl -k
How to remove first element of a array?
- unshift
- delete
- shift
- move
what is output of print abs("123abc") ?
- 0
- 123
- abc
- 12
How to check if key exists in a hash or not ?
- exists
- defined
- undef
- exist
chomp(@array) will
- work on first eleemnt of array
- work on last element of array
- works on all elements of array
- wont work on array
Which function you will use to create object in perl?
- bless
- createobject
- create_object
- blessed
Which special variable actually tells perl where to look for perl modules ?
- %INC
- @INC
- INC
- %PATH%
How to length of string ?
- Length
- length
- len
- strlen
How to compile a perl program?
- perl -c <<programname>>
- perl -c
- You cannot compile a program
- perl -e <<programname>>
Which subroutine you need to define in your package if you want to handle calls to non-existing subroutines?
- DESTROY
- AUTOHANDLE
- AUTOLOAD
- AUTOLOADER
What is the name of default namespace in perl?
- main
- Main
- global
- name
Which of the following block executes at compile time?
- END
- BEGIN
- CHECK
- INIT
Which function removes last character of a string?
- chop
- chomp
- delete
- chopp