Tie a file handle to a variable

Discussion in 'Perl' started by Carlo Filippini, Sep 29, 2003.

  1. Hi
    how can I tie a file handle to a variable (probably tie is not
    the right perl terminology in this case)? Basically I want that
    everything that is written to a file is copied into a variable as
    well. Of course I could read the file again, something like

    while (<FH>){
    ....
    }

    but I need to chenge the variable dinamically.
    Is it possible somehow?

    Thanks
    Carlo
     
    Carlo Filippini, Sep 29, 2003
    #1
    1. Advertisements

  2. Carlo Filippini

    Guest

    (Carlo Filippini) wrote in message news:<>...
    > how can I tie a file handle to a variable (probably tie is not
    > the right perl terminology in this case)? Basically I want that
    > everything that is written to a file is copied into a variable as
    > well.


    Sounds like you want IO::Tee and IO::Scalar

    Note that as of 5.8 functionality similar to that of IO::Scalar is now
    in the Perl core (perldoc -f open).

    This newsgroup does not exist (see FAQ). Please do not start threads
    here.
     
    , Oct 2, 2003
    #2
    1. Advertisements

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

    Tie to change line in file

    Jonathan Weekes, Sep 14, 2003, in forum: Perl
    Replies:
    0
    Views:
    596
    Jonathan Weekes
    Sep 14, 2003
  2. Carlo Filippini

    Tie a file handle to a variable

    Carlo Filippini, Sep 29, 2003, in forum: Perl
    Replies:
    3
    Views:
    787
    Kris Wempa
    Oct 1, 2003
  3. SpecialK

    Tie a file to a hash

    SpecialK, Feb 19, 2004, in forum: Perl
    Replies:
    1
    Views:
    558
    Ben Morrow
    Feb 19, 2004
  4. SpecialK

    Tie a large file to a Hash

    SpecialK, Feb 19, 2004, in forum: Perl
    Replies:
    0
    Views:
    533
    SpecialK
    Feb 19, 2004
  5. Dietrich
    Replies:
    1
    Views:
    831
    Joe Smith
    Jul 22, 2004
  6. creamy

    Tie a file an IP address

    creamy, Jul 31, 2006, in forum: ASP General
    Replies:
    4
    Views:
    150
    Anthony Jones
    Aug 1, 2006
  7. John

    Module Tie::Handle::Intercepted

    John, May 6, 2004, in forum: Perl Misc
    Replies:
    0
    Views:
    215
  8. botfood

    tie() with DB_File not tie()ing ?

    botfood, Apr 24, 2006, in forum: Perl Misc
    Replies:
    23
    Views:
    712
    botfood
    Apr 26, 2006
Loading...