New to Perl

B

Bill Corden

Can someone give me an idea of what is going on with this line:

print FILE "$_\n$blocks{$_}";

I am trying to set a variable = to this amount so I can parse out some data.

$someData = "$_\n$blocks{$_}"
doesn't work
$someData = $_\n$blocks{$_}
doesn't work

If more code would be helpful, I can post it.

Thanks in advance
 
J

Jim Gibson

Bill Corden said:
Can someone give me an idea of what is going on with this line:

print FILE "$_\n$blocks{$_}";

This will print the contents of the variable $_, a new line, and the
contents of the hash element $blocks{$_} to the file handle FILE, which
presumably has been associated with a file using the open() function.
I am trying to set a variable = to this amount so I can parse out some data.

Equal to _what_ amount? Please be specific.
$someData = "$_\n$blocks{$_}"
doesn't work

This should work. It is valid Perl. It generates a string (see above
for contents) and stores it in the variable $someData. Tell us why you
think it "doesn't work".
$someData = $_\n$blocks{$_}
doesn't work

No, this is a syntax error.
If more code would be helpful, I can post it.

Yes, you should post a complete, working, small-as-possible program
that demonstrates the problem you are having and what you think the
program should be doing that it is not.

However, you should post it to comp.lang.perl.misc, because this
newsgroup is defunct (and be sure and follow the guidelines for that
newsgroup).

Good luck.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top