|
|
PERL
Tutorial
Example
9
Quote Types
Instead of using quotes like single (') , double (") , backtik (`) the
quote operators like q(), qq(), qx() are used respectively. The
following program illustrates the above
|
|
#quoted strings.
$str1=qq(hello);
$str2=q(world);
$str3=qx(ls -latr);
print $str1.$str2;
#prints hello world
The string $str3 holds the list of files under the current directory
including the hidden files (in UNIX environment) with the entire
details like filename, ownership,
time and date of creation etc,... |
Example
10
Finding the length of a string
The length() method or operator taking the string whose length has to
be found as argumnet is used.
#length
$str="Hello world";
$length_str=length($str);
print "The length of the string \$length_str is ".$length_str;
The \ (backslash) is used to escape characters like $, n, r , t, which
have special meaning
Go To Index
|
|
|