On Nov 28, Andrej Kastrin said:
I suppose that above example is not good one; here is the real one:
Mark
Francesco
Ann
Robert
transform to: "Mark","Francesco","Ann","Robert"
while (<SOURCE>)
{
my($line) = $_;
if ($line =~ $) #match to end of line
You don't need a regex here at all, and even if you did, the contents of
the regex need to be inside /.../.
{
print "$line"; #how to make e.g. "Mark",
}
}
In your case, you want to do something like:
while (<SOURCE>) {
chomp; # to remove the newline at the end of the string in $_
print qq{"$_",};
}
The qq{...} is a double-quoted string; that is, it's the same as "..."
except that it doesn't use " to delimit the string, but rather { and }.
This isn't a perfect solution for you, though, because it keeps a trailing
comma that I'm quite sure you don't want. But this is a start for you.
--
Jeff "japhy" Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://www.perlmonks.org/ % have long ago been overpaid?
http://princeton.pm.org/ % -- Meister Eckhart
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>