Ok now coming to the problem. Can someone explain to me that what this script is doing. I want to know the meaning of all the lines in the script.
$val = defined $val ? $val : "null";
$val =~ s/\'/$& x 2/eg; # double pad single quote character '
the first line sets val to null if it wasn't defined. the second line double pads the single quote character.