Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Reading a variable as a file

by thezip (Vicar)
on Nov 23, 2007 at 20:04 UTC ( #652651=note: print w/replies, xml ) Need Help??

in reply to Reading a variable as a file

You may want to investigate Tie::File for this.

Your wish is my commandline.

Replies are listed 'Best First'.
Re^2: Reading a variable as a file
by Dominus (Parson) on Nov 23, 2007 at 21:05 UTC
    Unless I misunderstand the question, Tie::File is the wrong thing here. It makes a file look like an array. But I think what OP wants is to make a scalar look like a file.

      Yes, you're absolutely right.

      But to me, this problem seems to fall somewhere in the middle regarding how it should be handled... On the one hand, a scalar containing the entire file would make it easier to perform the numerous regex substitutions, while on the other hand, an array would make it easier to to shift off the required items.

      I think the point I was trying to make was that an "array" (instead of reading the entire file into a scalar) might be another approach to this problem.

      Update: After re-reading the OP's question, I now realize that I pretty much ignored the basic spec for the problem.

      Your wish is my commandline.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://652651]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2018-06-20 06:19 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (116 votes). Check out past polls.