New to Perl

Discussion in 'Perl' started by Bill Corden, Mar 8, 2005.

  1. Bill Corden

    Bill Corden Guest

    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
    Bill Corden, Mar 8, 2005
    #1
    1. Advertising

  2. Bill Corden

    Jim Gibson Guest

    In article <3e439$422e02bb$97d5a94a$>, Bill Corden
    <> 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 =---
    Jim Gibson, Mar 8, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dpackwood
    Replies:
    3
    Views:
    1,765
  2. PerlFAQ Server

    FAQ 1.4 What are Perl 4, Perl 5, or Perl 6?

    PerlFAQ Server, Jan 23, 2011, in forum: Perl Misc
    Replies:
    0
    Views:
    283
    PerlFAQ Server
    Jan 23, 2011
  3. PerlFAQ Server
    Replies:
    0
    Views:
    651
    PerlFAQ Server
    Feb 3, 2011
  4. PerlFAQ Server

    FAQ 1.4 What are Perl 4, Perl 5, or Perl 6?

    PerlFAQ Server, Feb 27, 2011, in forum: Perl Misc
    Replies:
    0
    Views:
    275
    PerlFAQ Server
    Feb 27, 2011
  5. Replies:
    2
    Views:
    434
    Thomas 'PointedEars' Lahn
    Mar 11, 2008
Loading...

Share This Page