http://www.perlmonks.org?node_id=11113595


in reply to Re: Assigning multiple lines into first element of array
in thread Assigning multiple lines into first element of array

Everything works good but one more thing how can i count number of characters in first element of the array? When it returns first element of array it has many characters e.g: GAGGTGCTGGGGAGCAGCGTGTTTGCTGTGCTTGATTGTGAGCTGCTGGGAAGTTGTGACTTTCATTTTA CCTTTCGAATTCCTGGGTATATCTTGGGGGCTGGAGGACGTGTCTGGTTATTATATAGGTGCACAGCTGG. how come i count these characters?

  • Comment on Re^2: Assigning multiple lines into first element of array

Replies are listed 'Best First'.
Re^3: Assigning multiple lines into first element of array
by AnomalousMonk (Archbishop) on Mar 01, 2020 at 06:26 UTC

    See length:

    c:\@Work\Perl\monks>perl -wMstrict -le "my @ra = ('MANYCHARACTERS'); printf qq{1st element of array has %d characters \n}, length $ra[0]; " 1st element of array has 14 characters


    Give a man a fish:  <%-{-{-{-<

Re^3: Assigning multiple lines into first element of array
by tybalt89 (Monsignor) on Mar 01, 2020 at 08:08 UTC

    ...

    my @counts = map s/.*\n//r =~ tr/A-Z//, @array; print "counts: @counts\n";