[26375] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 8547 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 20 06:05:16 2005

Date: Thu, 20 Oct 2005 03:05:04 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 20 Oct 2005     Volume: 10 Number: 8547

Today's topics:
        Modify patterns inside files <boludovsky@hotmail.co.il>
    Re: Modify patterns inside files <bernard.el-haginDODGE_THIS@lido-tech.net>
    Re: why the perl docs suck robic0@yahoo.com
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 20 Oct 2005 08:23:22 GMT
From: ARIEL BOLUDOVSKY <boludovsky@hotmail.co.il>
Subject: Modify patterns inside files
Message-Id: <Xns96F5697946EC7wanadoo@157.170.133.60>


Hello,

I want to open a file, find a string, modify it, and then close the file.

open(FH, "+< $path1") or die "Opening: $!";
@my_ARRAY = <FH>;
	
# change ARRAY here
	
seek(FH,0,0) or die "Seeking: $!";
print FH @my_ARRAY  or die "Printing: $!";
truncate(FH,tell(FH)) or die "Truncating: $!";
close(FH); 	

Can anyone describe a quick method to find and modify a given pattern?

Thanks

ARIEL


------------------------------

Date: Thu, 20 Oct 2005 10:42:26 +0200
From: "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net>
Subject: Re: Modify patterns inside files
Message-Id: <Xns96F56CEB9D65Aelhber1lidotechnet@10.232.40.227>

ARIEL BOLUDOVSKY <boludovsky@hotmail.co.il> wrote:

> 
> Hello,
> 
> I want to open a file, find a string, modify it, and then close
> the file. 
> 
> open(FH, "+< $path1") or die "Opening: $!";
> @my_ARRAY = <FH>;
>      
> # change ARRAY here
>      
> seek(FH,0,0) or die "Seeking: $!";
> print FH @my_ARRAY  or die "Printing: $!";
> truncate(FH,tell(FH)) or die "Truncating: $!";
> close(FH);      
> 
> Can anyone describe a quick method to find and modify a given
> pattern? 


See the docs for Tie::File (a standard module, so you should already 
have it installed).


-- 
Cheers,
Bernard


------------------------------

Date: Thu, 20 Oct 2005 00:18:03 -0700
From: robic0@yahoo.com
Subject: Re: why the perl docs suck
Message-Id: <f1hel1h3iqb2gabrsg94j8kbclqq8jiq9o@4ax.com>

On Tue, 11 Oct 2005 10:42:17 +0200, Babacio <babacio@free.fr> wrote:
Hey man I'm just gonna flat out agree with this dude and the docs
do indeed suck. And if you try real hard maybe you will be 
sucked by the hype of perfection.
>"Fred@fred.net"
>
>> push ARRAY,LIST
>>
>> Treats ARRAY as a stack, and pushes the values of LIST onto the end of
>> ARRAY. The length of ARRAY increases by the length of LIST. 
>
>A few weeks ago I wondered if there was such a function. Then I RTFM,
>and these lines were enough for me, I used push without mistaking.
>What else do you need? Oh, maybe that:
>
>> Returns the new number of elements in the array.
>
>If one's not able to figure out what the function does with this
>fairly complete description (the name and syntax of the function are
>themselves quite self-documenting), one should give up programming, at
>least the time to grow up.
>
>But I suspect you're faking anger and even agressivity, just to have
>fun seeing people arguing or plonking you. Best troll start-up posted
>in the last few weeks, indeed! Enhorabuena :)



------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 8547
***************************************


home help back first fref pref prev next nref lref last post