Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I suspect you are confused because your final print statement emits something like $VAR1 = 'GLOB(0x817f880)'. As for why:

  • You never set the global separator to "//". You merely defined it to nothing at all. To set the record separator to "//", you do local $/='//'. That will break your input stream into records ending with '//'.
  • You never read in your file. Your split statement is attempting to split the string representation of an input handle, i.e. 'GLOB(...)', not the contents of your inputfile. To read a file into an array you need to use <$in>. To remove the '//' from the end you need to use chomp.

Your code should look something like this if you want to read in everything in one gulp:

local $/='//'; #define record separator my @records = <$in>; # read in all records chomp @records; #get rid of trailing // from each record

Or this, which reads in one record at a time and is much more memory efficient

local $/='//'; while (my $record = <$in>) { chomp $record; #remove // from end of line #... process the record ... }

In reply to Re: it should be simple enough... by ELISHEVA
in thread it should be simple enough... by lomSpace

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others romping around the Monastery: (8)
    As of 2021-04-20 21:10 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found