chomp returns whatever is chomped off, not the line, so $a, will end up being a bunch of delimiters.
Well, actually chomp() returns the number of "characters" that were chomped - not the delimiters. So the OP's code is not going to work or I will admit that I am having a hard time understanding what this thing it supposed to do.
A short demo of chomp() on my Windows machine:
#!usr/bin/perl -w
use strict;
#chomp demo
#running on Windows XP 32 bit...
# chomp... "It removes any line ending that corresponds
# to the current value of $/ (also known as
# $INPUT_RECORD_SEPARATOR in the English module)."
#
# chomp() returns the total number of "characters" removed.
# The "number of characters" depends....
my $count;
print "Count\t Text\n";
my $x ="blah...with CRLF (Windows)\n";
$count = chomp ($x);
print "$count \t\t $x\n";
print "setting \$/ to \\r\n";
$/ = "\r";
my $y ="blah...with CR (like Old Mac)\r";
$count = chomp ($y);
print "$count \t $y\n";
print "This won't work...An \"extra new line\" remains...\n";
my $z ="blah again with CRLF (Windows)\n";
$count = chomp ($z);
print "$count \t\t $z\n";
print "set \$/ back to \\n \n";
$/ = "\n";
$z ="blah again with CRLF (Windows) but 2 CRLF's\n\n";
$count = chomp ($z);
print "only one of the \\n's is chomped\n";
print "$count \t\t $z\n";
print "end of demo\n";
__END__
Count Text
1 blah...with CRLF (Windows)
setting $/ to \r
1 blah...with CR (like Old Mac)
This won't work...An "extra new line" remains...
0 blah again with CRLF (Windows)
set $/ back to \n
only one of the \n's is chomped
1 blah again with CRLF (Windows) but 2 CRLF's
end of demo