in reply to The Chomp Idea.
The chomp function works together with the global variable $/, the input record seperator. If chomp finds the value of $/ at the end of a string, it deletes it from the string. If $/ value is not at the end, there is no action.
That works nicely with the diamond input operator, <FOO>, since it breaks the input into strings based on the value of $/, leaving that value attached. That makes it common to see:
while (<FOO>) { chomp; # ...do stuff }
That idiom also makes use of the pronoun $_, which is set to the line read by 'while diamond..', and which is the default argument for chomp if no other is given.
After Compline,
Zaxo
|
|---|