Language question -- file = variable ?

Richard Dice richard.dice-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Tue Aug 16 14:55:00 UTC 2011


Consider the CPAN module Tie::File in Perl.  Read its docs at search.cpan.org.  The only differences between your example and it are:

 * The filename is not the variable identifier.
 * The variable is an array, not a scalar (which makes sense considering that files can contain many rows)

Cheers,
  Richard

Sent from my iPad

On 2011-08-16, at 10:41 AM, William Park <opengeometry-FFYn/CNdgSA at public.gmane.org> wrote:

> Hi all,
> 
> Is there a language which (natively or not) treats a filename like a variable in memory?  For example, to increment a counter stored in a file, you would write something like
>         /tmp/counter = /tmp/counter + 1
> which involves both read and write to a file.  If it were normal variable, then it would involve read/write to a memory instead.
> 
> Python is the closest I can think of.  But, you need to create a method for read and another method for write.  And, typing more verbose than I would like.
> 
> -- 
> 
> William
> --
> The Toronto Linux Users Group.      Meetings: http://gtalug.org/
> TLUG requests: Linux topics, No HTML, wrap text below 80 columns
> How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list