Sort: Rank

How to read file into hash array ?
How to read file into hash array ? open(IN, "<name_file") or die "Couldn't open file for processing: $!"; while (<IN>) { chomp; $hash_table{$_} = 0; } close IN; print "$_ = $hash_table{$_}\n" foreach keys %hash_table;
2013-09-10, 2454👍, 0💬

How many ways can we express string in Perl
How many ways can we express string in Perl? Many. For example 'this is a string' can be expressed as: 'this is a string' "this is a string" qq/this is a string like double-quoted string/ qq^this is a string like double-quoted string^ q/this is a string/ q&this is a string& q(this is a s...
2007-11-26, 5619👍, 0💬

Perl uses single or double quotes to surround a zero
Perl uses single or double quotes to surround a zero or more characters. Are the single(' ') or double quotes (" ") identical? They are not identical. There are several differences between using single quotes and double quotes for strings: The double-quoted string will perform variable interpolation...
2007-11-26, 5355👍, 0💬

Some nested data structure
Assume that $ref refers to a scalar, an array, a hash or to some nested data structure. Explain the following statements: $$ref; # returns the scalar pointed by $ref. $$ref[0]; # returns the first element of the array pointed by $ref. $ref->[0]; # returns the first element of the array pointe...
2007-11-21, 5868👍, 0💬

How to dereference a reference
How to dereference a reference? There are a number of ways to dereference a reference: Using two dollar signs to dereference a scalar like: $original = $$strref; Using @ sign to dereference an array like: @list = @$arrayref; Similar for hashes.
2007-11-21, 5501👍, 0💬

Does Perl have reference type?
Does Perl have reference type Yes. Perl can make a scalar or hash type reference by using backslash operator. For example: $str = "here we go"; # a scalar variable $strref = \$str; # a reference to a scalar @array = (1..10); # an array $arrayref = \@array; # a reference to an array Note that the ref...
2007-11-20, 5500👍, 0💬

How to turn on Perl warnings? Why is that important
How to turn on Perl warnings? Why is that important? Perl is very forgiving of strange and sometimes wrong code, which can mean hours spent searching for bugs and weird results. Turning on warnings helps uncover common mistakes and strange places and save a lot of debugging time in the long run. The...
2007-11-19, 5540👍, 0💬

What is Perl one-liner
What is Perl one-liner? There are two ways a Perl script can be run: From a command line, called one-liner - That means you type and execute immediately on the command line. You'll need the -e option to start like "C:\ %gt perl -e "print \"Hello\";". One-liner doesn't mean one Perl statement. One-li...
2007-11-19, 5731👍, 0💬

Why do you use Perl
Why do you use Perl? Perl is a powerful free interpreter. Perl is portable, flexible and easy to learn.
2007-11-19, 5833👍, 0💬

  Sort: Rank