use JSON::XS; my $data = [qw( qweqwe rtyr tyr \'asdasd fghfghfgh)]; my $json = encode_json $data; # to file... #### #!/usr/bin/env perl use JSON::XS; use strict; use warnings; use feature qw (say); # use Data::Dump; open my $fh, '<', 'data.dat' or die $!; while ( my $line = <$fh> ) { chomp $line; say nikolay( decode_json($line) ); } close $fh; sub nikolay { my $data = shift; join " ", @$data; # what ever... } __END__ karls-mac-mini:monks karl$ ./json.pl qweqwe rtyr tyr \'asdasd fghfghfgh ...