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}) }