what is it meants by ‘$_’?
It is a default variable which holds automatically, a list of arguements passed to the subroutine within parentheses.
It is a default variable which holds automatically, a list of arguements passed to the subroutine within parentheses.
Both of them are used to declare local variables. The variables declared with ‘my’ can live only within the block and cannot gets its visibility inherited functions called within that block, but one defined as ‘local’ can live within the block and have its visibility in the functions called within that block.
Pack Converts a list into a binary representation. Takes an array or list of values and packs it into a binary structure, returning the string containing the structure It takes a LIST of values and converts it into a string. The string contains a concatenation of the converted values. Typically, each converted values looks like… Read More »
perl -p -ibak -e ‘s/search_str/replace_str/g’
System calls “traditionally” returns 9 when successful and 1 when it fails. system (cmd) or die “Error in command”;
It is a symbolic link to link one file name to a new name. so lets say we do it like file1-> file2, if we read file1, we end up reading file2.
CHOP ‘chop’ function only removes the last character completely ‘from the scalar, where as ‘chomp’ function only removes the last character if it is a newline. by default, CHOMP chomp only removes what is currently defined as the $INPUT_RECORD_SEPARATOR. whenever you call ‘chomp ‘, it checks the value of a special variable ‘$/’. whatever the… Read More »
Use: 1. the method is used only for modules (only to include .pm type file) 2. the included object are verified at the time of compilation. 3. No Need to give file extentsion. Require: 1. The method is used for both libraries ( package ) and modules 2. The include objects are varified at the… Read More »
Answer : There is a ‘ref’ function . Perl provides the ref() function so that you can check the reference type before dereferencing a reference The ref() function can return are: Function Call Return Value ref( 10 ); undefined ref( 10); SCALAR ref( {1 => ; “Joe”} ); HASH ref(&firstSub ); CODE ref( 10); REF
One of the most basic uses for an array is as stack push | pop ==> LIFO shift | unshift ==> FIFO