Get length of string and array

Javascript (node.js)

let str = "A-B-C";
console.log(str.length);

let array = [1, 2, 3];
console.log(array.length);

Perl

my $str = "A-B-C";
print length($str)."\n";

my @array = (1, 2, 3);
my $len = $#array+1;
print $len."\n";

PHP

<?php
<?php
$str = "A-B-C";
print strlen($str)."\n";

$array = [1, 2, 3];
print len($array)."\n";

Python

example = "A-B-C"
print(str(len(example)))

array = [1, 2, 3]
print(str(len(array)))

Ruby

str = "A-B-C";
print(str.length)

array = [1, 2, 3]
print(array.length)