I am writing a command line perl program to replacetextcontentina file .I know that the following instruction executes successfully on one of the unix machine. [...]
Perl can handle both whole numbers (integers, like 37) and floating-point numbers (real numbers with decimal points, like 17.5 or -235.2). Internally, Perl [...]
Variable names can start with a letter, a number, or an underscore, although they normally begin with a letter and can then be composed of any combination of [...]
Assign some variables of a hash to an array. i.e you want to take some of the elements from hash based on there keys into a array here is a trick
%hash [...]
#
#
#
# use $b if $b is true, else $c
$a = $b || $c;
# set $x to $y unless $x is already true
$x ||= $y
# use $b if $b is defined, else $c
$a = defined($b) ? [...]
Windows
use File::Spec;
my $current_directory = File::Spec->rel2abs(".");
print $current_directory;
Unix
use Cwd;
my $current_directory = getcwd;
print [...]
Perl hashes have no internal order. A hash consists of a number of "buckets''. When a record is inserted into the hash, the key is transformed, using a "hash [...]
Many.
For example
'this is a string' can be expressed in:
"this is a string"
qq/this is a string like double-quoted string/
qq^this is a string like [...]