[root@windriver-machine test]# cat str.pl
#!/usr/bin/perl
$str="short";
$string="long";
print "match longest $string\n";
print "match shortlets ${str}ing\n";
[root@windriver-machine test]# perl str.pl
match longest long
match shortlets shorting
[root@windriver-machine test]#
root@windriver-machine test]# cat esc.pl
#!/usr/bin/perl
print "bell ring:\a\n";
print "back#\bspace\n";
print "copy\rabc\n";
print "abc\tdef\n";
print "the\$var\n";
print "a quote \" in string \n";
print "a quote \\ in string \n";
print "\045\n";
print "\x25\n";
print 'the \$var\n';
print 'this is the first line,
this is second line.\n';
[root@windriver-machine test]# perl esc.pl
bell ring:
backspace
abcy
abc def
the$var
a quote " in string
a quote \ in string
%
%
the \$var\nthis is the first line,
this is second line.\n[root@windriver-machine test]#
[root@windriver-machine test]# perl undef.pl
2
[root@windriver-machine test]# cat undef.pl
#!/usr/bin/perl
$r=$und+2;
print "$r\n";
[root@windriver-machine test]#
[root@windriver-machine test]# cat undef.pl
#!/usr/bin/perl -w
$r=$und+2;
print "$r\n";
[root@windriver-machine test]# perl undef.pl
Name "main::und" used only once: possible typo at undef.pl line 2.
Use of uninitialized value in addition (+) at undef.pl line 2.
2
[root@windriver-machine test]#
[root@windriver-machine test]# cat op.pl
#!/usr/bin/perl
print " minus the number before pot:";
$a=25.7%7.6;
print "$a\n";
print "log number is pot:";
$b=(25)**1.5;
print "$b\n";
print "auto increment for string,donot extrand length:";
$a='Z';
$a++;
print "$a\n";
print "the prority of || and or is not same:\n";
$a=1;
$b=1;
$c=($a+=0||$b);
print "$c\n";
$a=1;
$b=1;
$c=($a+=0 or $b);
print "$c\n";
print "=associativity :";
$a=2,$b=1;
$a*=$b+=5;
print "$a\n";
$a=2,$b=1;
($a*=$b)+=5;
print $a;
[root@windriver-machine test]# perl op.pl
minus the number before pot:4
log number is pot:125
auto increment for string,donot extrand length:AA
the prority of || and or is not same:
2
1
=associativity :12
7[root@windriver-machine test]#