place and plays $_ in perl?
Method 1:
Method 2:
Method 3:
while(<>) { print; }
Method 2:
for ('l','s','h','c','g') { print; print "\n"; }
Method 3:
@a=split //,'hello';
Method 4:
$_="hello"; $_=~s/he/she/g; print $_;
Method 5:
$_="he l lo"; for (split) { print; print "\n"; }
Method 6:
$_='perlbot'; print if /p/;
Method 7:
foreach ('l','s','h','c','g') { print; print "\n"; }
Method 8:
$_ = "prlbot"; print /perl/ ?'perlbot':'normalbot',"\n";
Method 9:
$_="perl"; $_=~tr/p/P/; print $_;
Method 10:
@a=('l','s','h','c','g'); print grep $_,@a;
Method 11:
@a=('l','s','h','c','g'); print map $_,@a;
Method 12:
%hash=(1,2,7,4,9,6); while (each %hash) { print "$_=$hash{$_}\n"; }
Method 13:
opendir($_,"/tmp") || die "Can't open dir $!"; @array =readdir($_); closedir $_; print @array;
Method 14:
while(<>) { chomp($_); print $_; }
Method 15:
while(<>) { chop($_); print $_; }
Method 16:
while(<>) { chomp($_); $output = eval $_; print $output; }
Method 17:
$_="he l lo"; print length($_);
Method 18:
$_="he l k lo"; $v=reverse $_; print $v;
Method 19:
$_ = 9.0; print exp $_;
Method 20:
$_ = "10"; print hex $_;
Method 21:
$_ = "Hello Perl Bot"; print index $_, 'Perl';
Method 22:
$_="he l k lo"; $v=lc $_; print $v;
Method 23:
$_="he l k lo"; $v=uc $_; print $v;
Method 24:
$_="he l k lo"; $v=ucfirst $_; print $v;
Method 25:
$_="he l k lo"; $v=lcfirst $_; print $v;
Method 26:
$_ = "144"; print sqrt $_;
Method 27:
$_ = "Hello Perl Bot Perl"; print rindex $_, 'Perl';
Method 28:
while(($_ = getc) eq 'yes') { print $_; }
Method 29:
$_ = "Hello Perl Bot Perl"; if (defined $_) { print "$_ is defined"; }
Method 30:
$_ = "Hello Perl Bot Perl"; print $_;
0 Comments:
Post a Comment
Note: only a member of this blog may post a comment.
<< Home