how many types available for getting string variable length in perl?
Method 1:
my $c = map $_, $h =~ /(.)/g;
Method 2:
my $c = split '', $h;
Method 3:
my $count = () = "hello" =~ /./g;
Method 4:
print length $h;
Method 5:
$cnt = "hello" =~ tr/[a-z][A-Z][0-9]//;
Method 6:
$h='hello';
my $v=$h=~ s/[a-z]//g;
Method 7:
print @_ = push(@_, map $_, (split '', 'hellgo'));
Method 8:
print @_ = push(@_, grep $_, (split '', 'hellgo'));
Method 9:
print push(@_, grep $_, "hello" =~ /./g);
Method 10:
print push(@_, map $_, "hello" =~ /./g);
Method 11:
print push(@_, grep $_, reverse "hello" =~ /./g);
Method 12:
print push(@_, map $_, reverse "hello" =~ /./g);
Method 13:
print push(@_, map $_, (split '', 'hellgo'));
Method 14:
my $c = map $_, $h =~ /(.)/g;
Method 2:
my $c = split '', $h;
Method 3:
my $count = () = "hello" =~ /./g;
Method 4:
print length $h;
Method 5:
$cnt = "hello" =~ tr/[a-z][A-Z][0-9]//;
Method 6:
$h='hello';
my $v=$h=~ s/[a-z]//g;
Method 7:
print @_ = push(@_, map $_, (split '', 'hellgo'));
Method 8:
print @_ = push(@_, grep $_, (split '', 'hellgo'));
Method 9:
print push(@_, grep $_, "hello" =~ /./g);
Method 10:
print push(@_, map $_, "hello" =~ /./g);
Method 11:
print push(@_, grep $_, reverse "hello" =~ /./g);
Method 12:
print push(@_, map $_, reverse "hello" =~ /./g);
Method 13:
print push(@_, map $_, (split '', 'hellgo'));
Method 14:
my $c = grep/./, (reverse split '', 'hello');
print $c;
Method 15:
my $c = map $_, (reverse split '', 'hello');
print $c;
Method 16:
my $c = map $_, (reverse "hello" =~ /./g);
print $c;
Method 17:
my $c = grep/./, (reverse "hello" =~ /./g);
print $c;
Method 18:
my $c = map $_, (reverse split '', 'hello');
print $c;
Method 19:
my $c = grep/./, (reverse split '', 'hello');
print $c;
Method 20:
print scalar map $_, 'hello' =~ /(.)/g;
Method 21:
print scalar grep/./,'helloh' =~ /(.)/g;
Method 22:
print scalar map $_, (reverse "hello" =~ /./g);
Method 23:
print scalar map $_, (reverse split '', 'hello');
print scalar map $_, (reverse split '', 'hello');
Method 38:
print length reverse grep/./,'helloh' =~ /(.)/g;
Method 39:
print length reverse map $_,'helloh' =~ /(.)/g;
Method 40:
print grep/./, (reverse "hello" =~ tr/[a-z][A-Z][0-9]//);
Method 41:
print map $_, (reverse "hello" =~ tr/[a-z][A-Z][0-9]// );
For More Methods Reach Me:@ letscrackperlinterviewblogspot@gmail.com
print $c;
Method 15:
my $c = map $_, (reverse split '', 'hello');
print $c;
Method 16:
my $c = map $_, (reverse "hello" =~ /./g);
print $c;
Method 17:
my $c = grep/./, (reverse "hello" =~ /./g);
print $c;
Method 18:
my $c = map $_, (reverse split '', 'hello');
print $c;
Method 19:
my $c = grep/./, (reverse split '', 'hello');
print $c;
Method 20:
print scalar map $_, 'hello' =~ /(.)/g;
Method 21:
print scalar grep/./,'helloh' =~ /(.)/g;
Method 22:
print scalar map $_, (reverse "hello" =~ /./g);
Method 23:
print scalar map $_, (reverse split '', 'hello');
Method 24:
print scalar map $_, (split '', 'hello');
Method 25:
print $r = @_= map $_, (split '', 'hello');
Method 26:
print $r = @_= grep $_, (split '', 'hello');
Method 27:
print $r = @_= grep $_, (reverse "hello" =~ /./g);
Method 28:
print $r = @_= grep/./,'helloh' =~ /(.)/g
Method 29:
print $r = @_= map $_, (reverse "hello" =~ /./g);
Method 30:
print $r = @_= map/./,'helloh' =~ /(.)/g
Method 31:
print $r = @_= map $_, (split '', 'hello');
Method 32:
print $r = @_= grep $_, (split '', 'hello');
Method 33:
print $r = @_= grep $_, (reverse "hello" =~ /./g);
Method 34:
print $r = @_= grep/./,'helloh' =~ /(.)/g
Method 35:
print $r = @_= map $_, (reverse "hello" =~ /./g);
Method 36:
print $r = @_= map/./,'helloh' =~ /(.)/g
Method 37:
Method 38:
print length reverse grep/./,'helloh' =~ /(.)/g;
Method 39:
print length reverse map $_,'helloh' =~ /(.)/g;
Method 40:
print grep/./, (reverse "hello" =~ tr/[a-z][A-Z][0-9]//);
Method 41:
print map $_, (reverse "hello" =~ tr/[a-z][A-Z][0-9]// );
For More Methods Reach Me:@ letscrackperlinterviewblogspot@gmail.com
Labels: data types in perl with example, perl if length of string, perl if string length greater than, perl length of string, perl string length in bytes, substring in perl
0 Comments:
Post a Comment
Note: only a member of this blog may post a comment.
<< Home