Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Is a here-doc a good way to retrieve data file contents for testing?

by BillKSmith (Prior)
on Jan 17, 2021 at 20:01 UTC ( #11127042=note: print w/replies, xml ) Need Help??


in reply to Is a here-doc a good way to retrieve data file contents for testing?

The 'file' which you are simulating almost certainly has a newline at the end of every (including the last) line. The 'chomp' to remove the newline from the last line of your test file serves as a reminder that the same function is needed in the real code.
Bill
  • Comment on Re: Is a here-doc a good way to retrieve data file contents for testing?

Replies are listed 'Best First'.
Re^2: Is a here-doc a good way to retrieve data file contents for testing?
by Lotus1 (Vicar) on Jan 18, 2021 at 00:46 UTC
    The 'file' which you are simulating almost certainly has a newline at the end of every (including the last) line.

    In fact it doesn't. At least you only said 'almost' certainly. LOL. The json file is part of an archive that is exported from my phone. I wrote a text extractor to get all my memos from these archive files. The json file it extracts has no newline on the last line hence this discussion.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11127042]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2021-04-16 02:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?