🎴 Flashcard Mode

SAS, Java, and Perl Programming Basics

Card1 / 20
Mastered0
Review0
QuestionClick to flip

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

AnswerClick to flip back
A
5 and 0
💡 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'.

Change Mode