Re: how to read the last line of a file directly?

2008-07-06 Thread Telemachus Odysseos
On Sun Jul 06 2008 @ 8:09, loody wrote: > Dear all: > I try to read the last line of a file directly instead of using > while(<>) or something else to read each line until "undef" bumped to > me. > If you know some build-in functions or another modules for me to use, > please help me. My first th

Re: how to change string to scalar

2008-07-06 Thread Telemachus Odysseos
On Sun Jul 06 2008 @ 5:58, loody wrote: > BTW, do you know where I can find the whole list after substitution > and pattern matching, m/,? Check out these three parts of the documentation: perldoc perlrequick perldoc perlretut perldoc perlre That goes in increasing order of complexity, detail,

A question about the Llama exercises

2007-11-19 Thread Telemachus Odysseos
Maybe a better title is "A question about the comments on one of the answers to an exercise." Anyhow, this seems like a reasonable place to ask. I just finished doing the exercises for chapter 4 in the Llama book (on subroutines) and for question 3, I produced this for a subroutine to collect numbe

Re: Modifing Text Files

2007-10-28 Thread Telemachus Odysseos
On 10/25/07, Chas. Owens <[EMAIL PROTECTED]> wrote: > > From the sound of it what you want is in-place-editing: > > #!/usr/bin/perl -i > > use strict; > use warnings; > > while (<>) { > s/this/that/ > } > > The code above will read in any number of files modifying "this" to > "that" in each on

Listing files and their sizes

2007-09-18 Thread Telemachus Odysseos
Hi, I have read around and cannot seem to find an answer to this, and it's driving me a bit nuts. I have a small script that I am trying to use to list the items in a directory and the size of the items. The script works perfectly if I run it in the directory itself, but if the script is somewhere