Hi All I have the following code, which I intend to use to save/restore an array to/from a text file with.
As I'm using a comma to delilmit the data I'm escaping commas on the way out, an unescaping on the way in. This means that when I split the string into an array, I need to make sure I DON'T split on escaped commas, hence the /[^\\],/ regex in my split. But my problem is that this split strips the last character off all but the last element in the array. Is there some way to exclude the [^\\] part from being matched, err or something, help. My code... my @array = ('tasty', 'cheese'); my $escaped_array = join(",", map {$_ =~ s/,/\\,/g; $_} @array); my @restored_array = map { $_ =~ s/\\,/,/g; $_ } split(/[^\\],/, $escaped_array); print $restored_array[0] . "\n"; OUTPUT tast ---------------- Thanks for any help Rob Anderson -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]