in reply to Re: $" seems not to be working
in thread $" seems not to be working

To make it absolutely clear: you have to set $, to this effect, for the syntax you've used here, or you set $" and put the array slice in quotes. BTW you'd better use local on those variables, as they are globals, and they might influence the rest of your script, even the working of modules.
{ local $, = "|"; print @record[1..$fields]; }
or
{ local $" = "|"; print "@record[1..$fields]"; }
The default value of $" is a space, of $, it's the empty string — or undef, same thing here (no warnings).

Note that the subscript of an array or a hash, or a ditto slice, is still evaluated as Perl code, at the time of interpolation. Thus, you can do calculations etc. there. Like:

@number = qw(zero one two three four five six seven eight nine ten); print "The sum of $number[1] and $number[2] is $number[1+2].\n";

The module Interpolation makes use of this little fact.