Re: how to change string to scalar

2008-07-06 Thread John W. Krahn
loody wrote: Dear all: I try to update the end of my file index by 1 per day. ex: file_0 --> file_1 file_10 --> file_11 I know I can do some stupid things as writing 10 elseifs to determine right now value and write back it after adding 1. But is there some faster way to do so? Lik

recording with perl

2008-07-06 Thread Octavian Rasnita
Hi, Does anyone know if there is a perl module that can be used for recording in .wav format? (One that can be used under both Linux and Windows, or at least under Windows.) Thank you. Octavian -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: how to change string to scalar

2008-07-06 Thread Dr.Ruud
loody schreef: > I try to update the end of my file index by 1 per day. > ex: > file_0 --> file_1 > file_10 --> file_11 I think you are looking for something like s/(?<=^file_)([0-9]+)$/$1+1/e Example: $ echo -e 'file_0\nfile_10' | perl -wpe' s/(?<=^file_)([0-9]+)$/$1+1

Re: how to change string to scalar

2008-07-06 Thread loody
Hi all: I find out what I need from your replies, which is the "/e" at the end of substitution. I google on the web and it says evaluate the expression. that means I can transfer the pattern I got from string to scalar and do the addition. BTW, do you know where I can find the whole list after subs

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,

how to read the last line of a file directly?

2008-07-06 Thread loody
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. appreciate your help, miloody -- To unsubscribe, e-mail: [EMAI

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

2008-07-06 Thread Aruna Goke
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. appreciate your help, miloody use File::Tail mo

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

2008-07-06 Thread loody
Hi: I look at http://perldoc.perl.org/index-modules-F.html but I cannot see File::Tail. Would you please tell me where I can get the document describing how to use it? appreciate your help, miloody 2008/7/6 Aruna Goke <[EMAIL PROTECTED]>: > loody wrote: >> >> Dear all: >> I try to read the last li

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 read the last line of a file directly?

2008-07-06 Thread Gunnar Hjalmarsson
loody wrote: I look at http://perldoc.perl.org/index-modules-F.html but I cannot see File::Tail. File::Tail is not a core module. Neither is File::ReadBackwards which was suggested by somebody else. You get non-core modules from CPAN http://search.cpan.org/ -- Gunnar Hjalmarsson Email: http

Re: anagrams

2008-07-06 Thread Gunwant Singh
Hi, Thnx for your solution, although I did not get the complete solution as explained in your earlier email. Can you please simplify your explanation. Also, would it not be possible w/o making wordlist.unified. Thanks. Dr.Ruud wrote: Gunwant Singh: I have a query regarding regexes.

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

2008-07-06 Thread Rob Dixon
loody wrote: > > 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. Like this. Both Fcntl and Tie::File are standard

Re: how to change string to scalar

2008-07-06 Thread Rob Dixon
loody wrote: > > I find out what I need from your replies, which is the "/e" at the end of > substitution. I google on the web and it says evaluate the expression. that > means I can transfer the pattern I got from string to scalar and do the > addition. > > BTW, do you know where I can find the

Re: simplify a path

2008-07-06 Thread Brad Baxter
On Jul 3, 4:38 pm, [EMAIL PROTECTED] (Rob Dixon) wrote: > > Pardon me for being dense, but I can't figure out a case where > > >> if ($path[-1] eq '..') { > > > would ever be true. > > My intention was to preserve relative paths starting with '..', but I got it > wrong. Here's V2. > > Rob > >

matching lines like grep

2008-07-06 Thread Noah
Hi there fellow PERL coders. I am trying to match lines between a template file and a configuration file. If the configuration is missing a particular line that is found in the template file then it is printed. If the configuration file has an extra line then it to gets printed. Something

Re: matching lines like grep

2008-07-06 Thread Rob Dixon
Noah wrote: > Hi there fellow PERL coders. > > I am trying to match lines between a template file and a configuration > file. If the configuration is missing a particular line that is found > in the template file then it is printed. If the configuration file has > an extra line then it to get

Re: matching lines like grep

2008-07-06 Thread Noah
I wish I could share the output. let me put toether some bogus output files. Cheers, Noah Rob Dixon wrote: Noah wrote: Hi there fellow PERL coders. I am trying to match lines between a template file and a configuration file. If the configuration is missing a particular line that is found

Re: how to change string to scalar

2008-07-06 Thread loody
Hi all: thanks for your help, miloody 2008/7/7 Rob Dixon <[EMAIL PROTECTED]>: > loody wrote: >> >> I find out what I need from your replies, which is the "/e" at the end of >> substitution. I google on the web and it says evaluate the expression. that >> means I can transfer the pattern I got from

Re: matching lines like grep

2008-07-06 Thread Rob Dixon
Noah wrote: > Rob Dixon wrote: >> Noah wrote: >>> Hi there fellow PERL coders. >>> >>> I am trying to match lines between a template file and a configuration >>> file. If the configuration is missing a particular line that is found >>> in the template file then it is printed. If the configurati

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

2008-07-06 Thread Amit Saxena
Hi Though I am not very sure, but can we use inbuilt seek function in perl ? Regards, Amit Saxena On Mon, Jul 7, 2008 at 12:39 AM, Rob Dixon <[EMAIL PROTECTED]> wrote: > loody wrote: > > > > I try to read the last line of a file directly instead of using > > while(<>) or something else to read

Re: how to change string to scalar

2008-07-06 Thread loody
hi: s/(?<=^file_)([0-9]+)$/$1+1/e ^^ this is looking for the end string with digits. but what (?<=^file_) means? I know "^file_" means the string begins with "file_" but what ?= and ( ) used for? appreciate your help, miloody 2008/7/6 Dr.Ruud <[EMAIL PROTECTED]>: > loody

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

2008-07-06 Thread Thomas Bätzler
loody <[EMAIL PROTECTED]> asked: > 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. Off the top of my head: #!/u