C-style buffer?

2008-09-02 Thread Vyacheslav Karamov
Hi All! How C-style buffer could be implemented in Perl? I need to download text file into buffer, then find some text in it with regular expression, then store some text *before* the match and then search some text with regular expression again, but starting from the end of the previous match

XML::Parser::Expat example

2008-09-02 Thread Vyacheslav Karamov
Hi All! Could someone give me some examples how to use XML::Parser::Expat? --- WBR, Vyacheslav. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Regex in a variable

2008-09-02 Thread Paolo Gianrossi
On Mon, 2008-09-01 at 11:40 -0400, Mr. Shawn H. Corey wrote: > > use strict; > > use warnings; > > use diagnostics; > > > > my $text="this is a random text. Please match random string.\nAnother > > random something.\n"; > > > > my $rexp=; > > chomp( $rexp ); > # I take it that you want $rexp to

Re:C-style buffer?

2008-09-02 Thread Jeff Pang
Hi, If you need to store the text content into memory and parse it later, you could use an array. > Message du 02/09/08 10:20 > De : "Vyacheslav Karamov" > A : beginners@perl.org > Copie à : > Objet : C-style buffer? > > > Hi All! > > How C-style buffer could be implemented in Perl? > I need to

Re: Regex in a variable

2008-09-02 Thread John W. Krahn
Paolo Gianrossi wrote: Alright! This works... I solved the minor issue of modifiers and simple matching instead of substitution (remember I need to take care of *arbitrary* regexes) by: my ($op, $replacement, $modifiers)=('', ''); if($rexp=~/^s(.)/){ $op='s'; my $delimiter=quotemeta($1);

Re: Only getting format header on first file of a series

2008-09-02 Thread Rob Dixon
Dave Thacker wrote: > On Monday 01 September 2008 20:29:27 Rob Dixon wrote: >> >> $- = 0; > > Unfortunately, there's no change after inserting that assignment. Thanks > for > the other info on the improving the preparation of the SQL statement. I'll > do that as soon as I get this resolved.

Perl equivalent of "sed -f" or "awk -f"

2008-09-02 Thread [EMAIL PROTECTED]
I'd like to apply a series of inline edits to a file in Perl. With sed, I could use "sed -f commandfile inputfile" or in awk, "awk - f commandfile inputfile", however, I could not find an equivalent in Perl. I'd prefer not to use sed or awk as they do not support inline editing directly. In Perl

RE: Perl equivalent of "sed -f" or "awk -f"

2008-09-02 Thread Andrew Curry
Perl -p -i -e "s/search/replace/;" -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 02 September 2008 15:06 To: beginners@perl.org Subject: Perl equivalent of "sed -f" or "awk -f" I'd like to apply a series of inline edits to a file in Perl. With sed, I could

Re: XML::Parser::Expat example

2008-09-02 Thread Mr. Shawn H. Corey
On Tue, 2008-09-02 at 11:53 +0300, Vyacheslav Karamov wrote: > Hi All! > > Could someone give me some examples how to use XML::Parser::Expat? You should use XML::Parser instead. Most Perl Mongers prefer to use XML::Twig or XML::SAX or XML::DOM. All are available at CPAN

Re: Regex in a variable

2008-09-02 Thread Mr. Shawn H. Corey
On Tue, 2008-09-02 at 05:35 -0700, John W. Krahn wrote: > It also doesn't work if there is whitespace between the operator name > and the delimiter, for example: 'm / abc /x' or 's / abc /def/x'. > > Or if the delimiter is part of the pattern, for example: 'm/..\/..\/../'. > > Or if the /e optio

Re: encrypt a text file

2008-09-02 Thread Jeff Pang
> Message du 27/08/08 16:40 > De : "Bryan R Harris" > A : "Beginners Perl" > Copie à : > Objet : Re: encrypt a text file > > > > > > hello, > > > > how to encrypt a text file and decrypt it with perl? > > > > for example, I have a config file, > > > > svr.conf > > > > I want to encrypt it to svr.c

Re: Regex in a variable

2008-09-02 Thread Mr. Shawn H. Corey
On Tue, 2008-09-02 at 10:43 -0400, Mr. Shawn H. Corey wrote: > On Tue, 2008-09-02 at 05:35 -0700, John W. Krahn wrote: > > It also doesn't work if there is whitespace between the operator name > > and the delimiter, for example: 'm / abc /x' or 's / abc /def/x'. > > > > Or if the delimiter is par

Re: Regex in a variable

2008-09-02 Thread Paolo Gianrossi
On Tue, 2008-09-02 at 10:51 -0400, Mr. Shawn H. Corey wrote: > Sorry, it's Tuesday after a long weekend; brain is not fully in gear > yet. Try: > > while( eval "\$text =~ s/$rexp/$replacement/$flags" ){ I tried this. Actually, I tried something slightly different: print "Enter rexp: "; my $rex

Re: Check for modules presence

2008-09-02 Thread Francesco Rotondella
Rob Dixon wrote: [...] All it does is to put some stub code in place of any missing modules, with an import routine that just pushes the name of the package onto array @main::NOTFOUND. Then the CHECK block code just reports the contents of that array and dies if it's not empty. There are a numbe

Re: Perl equivalent of "sed -f" or "awk -f"

2008-09-02 Thread John W. Krahn
[EMAIL PROTECTED] wrote: I'd like to apply a series of inline edits to a file in Perl. With sed, I could use "sed -f commandfile inputfile" or in awk, "awk - f commandfile inputfile", however, I could not find an equivalent in Perl. perl commandfile inputfile I'd prefer not to use sed or awk

Re: Simultaneous execution of multiple processes

2008-09-02 Thread sumeet .. Light my way..!!
On Sep 1, 8:51 pm, [EMAIL PROTECTED] (Peter Scott) wrote: > On Mon, 01 Sep 2008 05:45:58 -0700, sumeet .. Light my way..!! wrote: > > > > > On Sep 1, 5:08 pm, [EMAIL PROTECTED] (John W. Krahn) wrote: > >> sumeet .. Light my way..!! wrote: > > >> > Hi all, > > >> Hello, > > >> >     I have a problem

Re: Simultaneous execution of multiple processes

2008-09-02 Thread John W. Krahn
sumeet .. Light my way..!! wrote: Hey thanks for the reply. Things working slowly and steadily.I was able to successfully run many instances of notepad.exe simultaneously.However i am still not able to execute some exe's like firefox.exe , wmplayer.exe , googletalk.exe etc. I am using the follo

XS array of arrays

2008-09-02 Thread Patrick Dupre
Hello, I wanted to return an array of arrays from c to perl. I build up my arrays by unisng av_push, but then ? I cannot av_push a AV*, so should I make a newSV and filled it by casting, or should I make a newRV with the AV* (after casting) and push it ? Thank -- --- ==

Re: C-style buffer?

2008-09-02 Thread Rob Dixon
Vyacheslav Karamov wrote: > > How C-style buffer could be implemented in Perl? > I need to download text file into buffer, then find some text in it with > regular expression, > then store some text *before* the match and then search some text with > regular expression again, but starting > from

Re: Perl equivalent of "sed -f" or "awk -f"

2008-09-02 Thread [EMAIL PROTECTED]
On Sep 2, 10:49 am, [EMAIL PROTECTED] (John W. Krahn) wrote: > [EMAIL PROTECTED] wrote: > > I'd like to apply a series of inline edits to a file in Perl. > > > With sed, I could use "sed -f commandfile inputfile" or in awk, "awk - > > f commandfile inputfile", however, I could not find an equivalen