Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl (http://www.velocityreviews.com/forums/f17-perl.html)
-   -   New to Perl (http://www.velocityreviews.com/forums/t25504-new-to-perl.html)

Bill Corden 03-08-2005 07:53 PM

New to Perl
 
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






Jim Gibson 03-08-2005 09:40 PM

Re: New to Perl
 
In article <3e439$422e02bb$97d5a94a$5413@ALLTEL.NET>, Bill Corden
<Corden@somwhere.com> wrote:

> 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.


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---


All times are GMT. The time now is 03:43 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57