Tree
Tree

Reputation: 10362

How to do chomp a Perl array without using foreach?

How to do chomp the array without using a foreach?

 @array = ( " adfasdas 
", "asdas " , "23232 

",
"ads as" ; 

chomp (@array);

Upvotes: 2

Views: 19151

Answers (2)

signine
signine

Reputation: 3123

Exactly like that.

chomp @list;

'perldoc -f chomp' for more info.

Upvotes: 29

Zachary Wright
Zachary Wright

Reputation: 24070

Exactly how you're doing it.

chomp( @array );

Will chomp every element in the array.

Upvotes: 9

Related Questions