print string in file

print string in file

am 17.08.2010 13:59:42 von Irfan Sayed

--0-319478403-1282046382=:54054
Content-Type: text/plain; charset=us-ascii

Hi All,

I need to print some string into the file.
the string is like this : ""

i have written code like this :
print MYFILE "\n" where MYFILE is a file
handler.

if i run this code , it is giving so many syntax errors.
any advice please

Regards
Irfan



--0-319478403-1282046382=:54054--

RE: print string in file

am 17.08.2010 14:11:05 von Bob McConnell

From: Irfan Sayed

> I need to print some string into the file.=20
> the string is like this : ""
>=20
> i have written code like this :
> print MYFILE "\n" where =
MYFILE
is a file=20
> handler.
>=20
> if i run this code , it is giving so many syntax errors.=20
> any advice please

You can't have unescaped quotes in a quoted string. Try this:

print MYFILE "\n";

or this:

print MYFILE '' . "\n";

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: print string in file

am 17.08.2010 14:14:15 von Shawn H Corey

On 10-08-17 07:59 AM, Irfan Sayed wrote:
> Hi All,
>
> I need to print some string into the file.
> the string is like this : ""
>
> i have written code like this :
> print MYFILE "\n" where MYFILE is a file
> handler.
>
> if i run this code , it is giving so many syntax errors.
> any advice please
>
> Regards
> Irfan
>
>
>

Use a backslash to escape the internal double quotes:

print MYFILE "\n";


--
Just my 0.00000002 million dollars worth,
Shawn

Programming is as much about organization and communication
as it is about coding.

The secret to great software: Fail early & often.

Eliminate software piracy: use only FLOSS.

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: print string in file

am 17.08.2010 21:05:57 von rvtol+usenet

Irfan Sayed wrote:

> print MYFILE "\n"
> where MYFILE is a file handler.

s/handler/handle/

print $MYFILE qq{\n};

--
Ruud

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: print string in file

am 19.08.2010 08:30:32 von Irfan Sayed

--0-2084779122-1282199432=:78646
Content-Type: text/plain; charset=us-ascii

Thanks all
it worked.

--Irfan




________________________________
From: Dr.Ruud
To: beginners@perl.org
Sent: Wed, August 18, 2010 12:35:57 AM
Subject: Re: print string in file

Irfan Sayed wrote:

> print MYFILE "\n" where MYFILE is a file
>handler.

s/handler/handle/

print $MYFILE qq{\n};

-- Ruud

-- To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/



--0-2084779122-1282199432=:78646--