programming-examples/perl/String/chomp matches the input line separator defined by the $ system variable.pl
2019-11-15 12:59:38 +01:00

13 lines
277 B
Perl

If they do, chomp removes them.
#!/usr/local/bin/perl
$/ = "::"; # set input line separator
$scalar = "testing::";
$num = chomp($scalar);
print ("$scalar $num\n");
@list = ("test1::", "test2", "test3::");
$num = chomp(@list);
print ("@list $num\n");