Perl In Line Hack - Perform Variable Assigning and Deletion in one Line
Method 1:
Method 2:
Method 3:
Method 4:
Method 5:
Method 6:
Method 7:
Method 8:
Method 9:
Method 10:
Method 11:
Method 12:
Method 13:
Method 14:
Method 15:
kaavannan perl blogspot
($_ = 'hellio') =~ s/i//; print $_;
Method 2:
s/i// for (my $_ = 'hellio'); print $_;
Method 3:
substr(($_ = 'helloi'), index ($_, "i"), length($_),"") print $_;
Method 4:
map $_ =~ s/i//,$_='hellio'; print $_;
Method 5:
grep $_ =~ s/i//,$_='hellio'; print $_;
Method 6:
print grep $_=~/[^i]+/,split('',$_='hellio');
Method 7:
map $_=~tr/i//d,$_="hellio"; print $_;
Method 8:
$_=~ s/i// if $_='hellio'; print $_;
Method 9:
$_ =~ tr/i//d if $_ = 'hellio'; print $_;
Method 10:
print grep $_=~/[^i]+/, @_, split '', 'hellio';
Method 11:
print grep $_=~/[^i]+/, "hellio"=~ /./g;
Method 12:
($_='hellio')=~tr/i//d; print $_;
Method 13:
$_="hellio",$_=~tr/i//d; print $_;
Method 14:
print @_,grep $_=~/[^i]+/, (split '', 'hellio');
Method 15:
grep $_=~tr/i//d,$_="hellio"; print $_;
kaavannan perl blogspot
Labels: Hack, kaavannan perl blogspot, one line hack, perl hack, scalar hack