in reply to Request to sort out a problem in perl program for getting result as print "@a or $a" of a map function code

say $_ for map {sprintf (“%d”, length)} split/$motif/, $string;

You don't really need map there, you could just do:

say length for split /$motif/, $string;

And to store that in an array you would need map:

my @a = map length, split /$motif/, $string;
  • Comment on Re: Request to sort out a problem in perl program for getting result as print "@a or $a" of a map function code
  • Select or Download Code