Multiple choice technology programming languages

$input =”12345”; $value1 = chop($input); $value2=chomp($input”); print $value1, $value2;

  1. 1234 and 1

  2. 12345 and 0

  3. 1234 and 0

  4. 5 and 0

  5. 1 and 0

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

In Perl, chop() removes and returns the LAST character from a string (returns '5' from '12345'), leaving '1234'. chomp() removes trailing newlines and returns the count of characters removed (returns 0 since '12345' has no trailing newline). The input string $input remains unchanged as '12345'. So print outputs '5' and '0'.