in reply to passing string to sub and string split

i believe the possible reason is i wrongly understand what is passing in the sub?

The Data::Dumper module can be very helpful when you are uncertain what data you are dealing with. To see what arguments are being passed to your subroutine, you can do something like the following:

use strict; use warnings; use Data::Dumper; sub mysub { print Dumper(\@_); } mysub( { name => 'ddd111', quantity => 11, price => '11', colour => '11red', size => '11xxl', itemID => '1111tiem' },{ quantity => '2', name => '222gmailoknow', price => '228', itemID => '222item' } );

This produces

$VAR1 = [ { 'colour' => '11red', 'quantity' => 11, 'name' => 'ddd111', 'price' => '11', 'itemID' => '1111tiem', 'size' => '11xxl' }, { 'name' => '222gmailoknow', 'quantity' => '2', 'price' => '228', 'itemID' => '222item' } ];

From this, you can see what arguments are being passed to subroutine mysub().