in reply to Add Quotes to entries in a file

It's an unusual requirement for sure (homework?) but taking you at your word:

use strict; use warnings; use Test::More tests => 2; my @rec = ( { have => 'ABC;123;;;;;HELLO;', want => 'ABC;"123";"";"";"";"";"HELLO";' }, { have => 'DEF;345;;BANANA;12DEF;44,55;4*12;;;;;;;;3;', want => 'DEF;"345";"";"BANANA";"12DEF";"44,55";"4*12";"";"";"" +;"";"";"";"";"3";' } ); for my $this (@rec) { $this->{have} =~ s/;/";"/g; $this->{have} =~ s/";/;/; $this->{have} =~ s/;"$/;/; is ($this->{have}, $this->{want}) }

I have a sneaking suspicion that the goalposts may be about to move. Let's hope not.