[22600] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4821 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Apr 6 11:06:07 2003

Date: Sun, 6 Apr 2003 08:05:06 -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           Sun, 6 Apr 2003     Volume: 10 Number: 4821

Today's topics:
    Re: "globbing" command line args on W2K? (Joe Smith)
        <script language=PerlScript> for Mozilla initiative <founder@pege.org>
    Re: array shift <bongie@gmx.net>
    Re: array shift <bongie@gmx.net>
    Re: Checkbox  Values Into a DB <mbudash@sonic.net>
    Re: CHMOD problems (Joe Smith)
    Re: Database overwriting itself <grazz@nyc.rr.com>
        Find a module info (News::Search) <sun_tong@users.sourceforge.net>
    Re: Find a module info (News::Search) <mgjv@tradingpost.com.au>
    Re: Formatting output in columns: <tore@aursand.no>
        Fusebox like framework <bobx@linuxmail.org>
        Graphics and games <mail@annuna.com>
    Re: Graphics and games <goodcall__1@hotmail.com>
    Re: Graphics and games <founder@pege.org>
    Re: LWP post problem (Chacrint Charinthorn)
    Re: open fails with filename starting with space <goldbb2@earthlink.net>
        Perl module builder <sun_tong@users.sourceforge.net>
    Re: PHP Code to PERL conversion... (Vijoy Varghese)
    Re: PHP Code to PERL conversion... <tony_curtis32@yahoo.com>
    Re: PHP Code to PERL conversion... <ian@WINDOZEdigiserv.net>
    Re: PHP Code to PERL conversion... (Vijoy Varghese)
    Re: Reformated Why won't this work. <me@privacy.net>
    Re: Simple, but I can't figure it out. (Joe Smith)
    Re: Substitution won't match for me <hiro@asari.net>
        transfera file server to server <primo.lgz@tiscali.it>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 06 Apr 2003 10:31:03 GMT
From: inwap@inwap.com (Joe Smith)
Subject: Re: "globbing" command line args on W2K?
Message-Id: <HlTja.7327$io.274968@iad-read.news.verio.net>

In article <3E7F0DB9.4090206@web.de>, Edwin Guenthner  <edgue@web.de> wrote:
>perl -MmyStuff xy*.pl

Have you tried using glob() ?

  C:\temp>perl -le "print join ' ',glob('xy*.pl')"

or

  my @files; foreach (@ARGV) { push @files,glob}; @ARGV = @files;

	-Joe

-- 
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.


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

Date: Sun, 6 Apr 2003 12:47:15 +0200
From: =?Windows-1252?Q?Roland_M=F6sl?= <founder@pege.org>
Subject: <script language=PerlScript> for Mozilla initiative
Message-Id: <3e90057a$0$19160$91cee783@newsreader02.highway.telekom.at>

Reusing browser technology

Why invent an own GUI,
when HTML and a common browser has
everything necessary for a GUI?

Why to learn 2 different GUI concepts like
TK and HTML, when one would do the same job?

Since 1997, it's possible to do this with a popular browser

<script languange=PerlScript>

# and here comes Perl code working with the GUI
# Perl subs as onMosueOver onClick event handlees

</script>

It's time, that Mozilla does the same trick


--
Roland Mösl
http://www.pege.org Clear targets for a confused civilization
http://web-design-suite.com Web Design starts at the search engine



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

Date: Sun, 06 Apr 2003 01:58:15 +0200
From: "Harald H.-J. Bongartz" <bongie@gmx.net>
Subject: Re: array shift
Message-Id: <2715480.xsN6dAaWeM@nyoga.dubu.de>

Jay Tilton wrote:
> It's not terribly clear how the new first element is chosen, but an
> array slice would be useful.
> 
>     my @ary = (50, 0, 44, 69, 0, 0, 200, 11 );
>     my $pivot = 4;
>     @ary = @ary[ $pivot .. $#ary, 0 .. $pivot-1 ];

Or push and splice:

    push @ar, splice @ar, 0, $pivot;


Ciao,
        Harald
-- 
Harald H.-J. Bongartz <bongie@gmx.net>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Interesting Error Messages #3:
 ..... REALITY.SYS Corrupted - Unable to recover Universe 



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

Date: Sun, 06 Apr 2003 02:22:49 +0200
From: "Harald H.-J. Bongartz" <bongie@gmx.net>
Subject: Re: array shift
Message-Id: <3758887.Ymp8Vx0ZPn@nyoga.dubu.de>

Harald H.-J. Bongartz wrote:

> Jay Tilton wrote:
>> It's not terribly clear how the new first element is chosen, but an
>> array slice would be useful.
>> 
>>     my @ary = (50, 0, 44, 69, 0, 0, 200, 11 );
>>     my $pivot = 4;
>>     @ary = @ary[ $pivot .. $#ary, 0 .. $pivot-1 ];
> 
> Or push and splice:
> 
>     push @ar, splice @ar, 0, $pivot;

 ... which in fact benchmarks also faster, from about 30% in worst case
(rotating n-1 elements of an n element list) up to arbitraty large
factors (e.g. a factor of 600 faster in a 1-element-rotate on a 1000
element list).

(Tested with Perl 5.8.0 on Linux 2.4.20.)


Ciao,
        Harald
-- 
Harald H.-J. Bongartz <bongie@gmx.net>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
If programming was easy, they wouldn't need something as complicated as
a human being to do it, now would they?
                -- Programming Perl, 3rd Ed.



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

Date: Sun, 06 Apr 2003 04:14:32 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Checkbox  Values Into a DB
Message-Id: <mbudash-F870A9.20143205042003@typhoon.sonic.net>

In article <3e8f582e$1_1@nntp2.nac.net>, Jessica <jessicak@nac.net> 
wrote:

> Hi,
> 
> I'm using Perl to input results of a form into a MySQL database.
> 
> I'm using the CGI module
> 
> The problem is with the checkbox's (Box1 name="interests" 
> value="hiking", Box2 name="interests" value="skiing", Box3 
> name="interests" value="swiming" etc...
> 
> Everything else on the form is working but with the checkbox values I'm 
> only getting the first checked value put into the DB. I know that this 
> probably has something to do with arrays but I'm clueless as what to do 
> about looping through it to get a string to put into a variable (with a 
> space between each value) that I can put into the db.
> 
> Any one have a snippet of code and could you give a brief description of 
> what it's doing??

we'll show you ours if you'll show us yours (your code, that is)...

seriously, let's see what you've tried. here's a clue, though, straight 
from the CGI docs available as usual at 
http://stein.cshl.org/WWW/software/CGI/:

> Fetching The Value(s) Of A Named Parameter
> 
>    @values = $query->param('foo');
>              -or-
>    $value = $query->param('foo');
> 
> Pass the param() method a single argument to fetch the value of the named 
> parameter. If the parameter is multivalued (e.g. from multiple selections in 
> a scrolling list), you can ask to receive an array. Otherwise the method will 
> return a single value. 
> 
> If a value is not given in the query string, as in the queries 
> "name1=&name2=" or "name1&name2", it will be returned as an empty string (not 
> undef). This feature is new in 2.63, and was introduced to avoid multiple 
> "undefined value" warnings when running with the -w switch.


hth-

-- 
Michael Budash


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

Date: Sun, 06 Apr 2003 10:46:37 GMT
From: inwap@inwap.com (Joe Smith)
Subject: Re: CHMOD problems
Message-Id: <hATja.7328$io.274968@iad-read.news.verio.net>

In article <u9llz8372y.fsf@wcl-l.bham.ac.uk>,
Brian McCauley  <nobull@mail.com> wrote:
>"David S." <southtownoutkast777@hotmail.com> writes:
>> for ($k=0; $k<@files; $k++) {
>>     chmod 0755, $files[$k];
>> }
>
>  You used a 'for' for no reason.  chmod() takes a list of filenames.

  chmod 0755,@files or warn "chmod() failed a file, guess which one";

	-Joe
-- 
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.


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

Date: Sat, 05 Apr 2003 23:39:03 GMT
From: Steve Grazzini <grazz@nyc.rr.com>
Subject: Re: Database overwriting itself
Message-Id: <rOJja.1403$py2.323@twister.nyc.rr.com>

spyderscripts <sulfericacid@qwest.net> wrote:
> Can someone tell me why my database keeps rewriting itself only 
> saving the last value given to it?
> 
>     if ( param('email') ne "" ) {
>         tie %emails, 'SDBM_File', $list, O_CREAT | O_RDWR, 0644;
> 
>         if ( !tied %emails ) {
>             warn("database unsuccessful $!.\n");
>         }
>         $emails{$email} = "test";

If the tie() failed you'll have a warning in the server's error
log (did you check?) and a plain hash with only one entry.

And then you print the success message anyway:

>         print "Email address added to database!";
>         foreach ( sort keys(%emails) ) {
>         print "$_ => $emails{$_}<br>";
>         }

-- 
Steve


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

Date: Sun, 06 Apr 2003 03:34:06 GMT
From: * Tong * <sun_tong@users.sourceforge.net>
Subject: Find a module info (News::Search)
Message-Id: <OeNja.7521$oA1.1126044@news20.bellglobal.com>

Hi, 

I found in the cpan module name space that there is a module called
News::Search:

perl -MCPAN -e 'for $m (CPAN::Shell->expand("Module","/./")){print
$m->id,"\n"}' 

How I can find any information related with this module? 

Thanks

PS.
I've tried

http://search.cpan.org/
http://www.cpan.org/modules/01modules.index.html
http://www.cpan.org/modules/00modlist.long.html

-- 
Tong (remove underscore(s) to reply)
  *niX Power Tools Project: http://xpt.sourceforge.net/
  - All free contribution & collection


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

Date: Sun, 6 Apr 2003 15:44:06 +1000
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Find a module info (News::Search)
Message-Id: <slrnb8vfl6.5s4.mgjv@martien.heliotrope.home>

On Sun, 06 Apr 2003 03:34:06 GMT,
	* Tong * <sun_tong@users.sourceforge.net> wrote:
> Hi, 
> 
> I found in the cpan module name space that there is a module called
> News::Search:
> 
> perl -MCPAN -e 'for $m (CPAN::Shell->expand("Module","/./")){print
> $m->id,"\n"}' 
> 
> How I can find any information related with this module? 

Euhmm... with the CPAN module.

$ perl -MCPAN -e 'CPAN::Shell->i("News::Search")'
[snip]
Module id = News::Search
    DESCRIPTION  console based Usenet news searching toolset
    CPAN_USERID  SUNTONG (Tong Sun <suntong@geocities.com>)
    CPAN_VERSION undef
    CPAN_FILE    Contact Author Tong Sun <suntong@geocities.com>
    DSLI_STATUS  aupO (alpha,comp.lang.perl.*,perl,object-oriented)
    INST_FILE    (not installed)

Pay specific attention to the line that starts with "CPAN_FILE".

Martien

PS. You can, of course, also simply do it while in interactive mode.
-- 
                        | 
Martien Verbruggen      | The problem with sharks is that they are too
                        | large to get to the shallow end of the gene
                        | pool. -- Scott R. Godin


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

Date: Sun, 06 Apr 2003 16:21:27 +0200
From: "Tore Aursand" <tore@aursand.no>
Subject: Re: Formatting output in columns:
Message-Id: <pan.2003.04.04.08.11.58.928151@aursand.no>

On Fri, 04 Apr 2003 01:05:32 -0500, Benjamin Goldberg wrote:
>>> I thouroughly searched newsgroups and faq, but I couldn't find the
>>> answer to my question

>> I don't believe you.  'perldoc -q format' gives you _excactly_ what
>> you're after.

> I didn't see any such answer under 'perldoc -q format'.

Frustrated as I was when I wrote that message, I managed to hit the 'q'
instead of 'f'. :-)

> Maybe you meant "perldoc perlform"?

Yes.  'perldoc -f format' points to 'perldoc perlform'.


-- 
Tore Aursand <tore@aursand.no>

"You know the world is going crazy when the best rapper is white, the best
 golfer is black, France is accusing US of arrogance and Germany doesn't
 want to go to war."


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

Date: Sun, 06 Apr 2003 02:24:58 GMT
From: "Bob X" <bobx@linuxmail.org>
Subject: Fusebox like framework
Message-Id: <_dMja.10894$FN.6750018@news2.news.adelphia.net>

Is there a fusebox (www.fusebox.org) type framework for Perl out there
somewhere?

Bob




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

Date: Sat, 05 Apr 2003 20:25:51 -0600
From: Joe Creaney <mail@annuna.com>
Subject: Graphics and games
Message-Id: <3E8F902F.6070003@annuna.com>

I have trying to program some games in perl.  I have been stuck in 
qkward text situations.  Is there a way I can add simple graphics to my 
games.  I am fimmilliar with TK but couldn't get a simple example to work.



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

Date: Sun, 06 Apr 2003 04:22:52 GMT
From: "Jack D." <goodcall__1@hotmail.com>
Subject: Re: Graphics and games
Message-Id: <wYNja.24571$7L.1521655@news0.telusplanet.net>

"Joe Creaney" <mail@annuna.com> wrote in message
news:3E8F902F.6070003@annuna.com...
> I have trying to program some games in perl.  I have been stuck in
> qkward text situations.  Is there a way I can add simple graphics to my
> games.  I am fimmilliar with TK but couldn't get a simple example to work.
>

Is there something in particular you have in mind? I program my games using a
Canvas. This allows you to use simple graphics using the myriads of item types
available to you - including images. So effectively, just about anything 2D is
'possible'. However,  only simple games are actually 'practical' using Tk. I'm
talking late 70's - early 80's vintage arcade games. If there is anyone who has
any more advanced games programmed using Tk, I would be interested in seeing
them.
--
Jack D.
Remove '__' from address if replying by e-mail.





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

Date: Sun, 6 Apr 2003 12:33:40 +0200
From: =?iso-8859-1?Q?Roland_M=F6sl?= <founder@pege.org>
Subject: Re: Graphics and games
Message-Id: <3e900579$0$19160$91cee783@newsreader02.highway.telekom.at>

"Joe Creaney" <mail@annuna.com> wrote in message
news:3E8F902F.6070003@annuna.com...
> I have trying to program some games in perl.  I have been stuck in
> qkward text situations.  Is there a way I can add simple graphics to my
> games.  I am fimmilliar with TK but couldn't get a simple example to work.

Wha do You not use

<script language=PerlScript>

and DHTML for it?


--
Roland Mösl
http://www.pege.org Clear targets for a confused civilization
http://web-design-suite.com Web Design starts at the search engine



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

Date: 6 Apr 2003 05:01:54 -0700
From: chacrint@hotmail.com (Chacrint Charinthorn)
Subject: Re: LWP post problem
Message-Id: <bfe227db.0304060401.42de237e@posting.google.com>

Michael Budash <mbudash@sonic.net> wrote in message news:<mbudash-1854CA.11224705042003@typhoon.sonic.net>...
> In article <bfe227db.0304050253.559dd87b@posting.google.com>,
>  chacrint@hotmail.com (Chacrint Charinthorn) wrote:
> 
> > I tried to post using LWP but I got the following error:
> > 
> > 500 (Internal Server Error) Can't read entity body: Connection reset by peer
> > 
> > is it the problem with the problem I tried to post to?
> 
> what happens when you try to post to the url using a standard web form 
> in a browser? what do you see?
> 
> hth-

I see the actual content as follow

Status=0


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

Date: Sat, 05 Apr 2003 21:01:25 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: open fails with filename starting with space
Message-Id: <3E8F8A74.25B32513@earthlink.net>

"Jürgen Exner" wrote:
> 
> Eddie Olsson wrote:
> > On Sat, 29 Mar 2003 03:23:12 GMT
> > "Jürgen Exner" <jurgenex@hotmail.com> wrote:
> >
> >> Vilmos Soti wrote:
> >>> I was writing a program which traversed a directory structure
> >>> (~/GNUstep), and I found that open couldn't open a filename with
> >>> a leading space. Is there a simple way (not sysopen) around it?
> >>
> >> Sure there is:
> >>     use File::Find;
> >> or
> >>     use File::Recurse;
> >>
> >> Then you don't have to write any directory traversing code at all.
> >
> > ...or simply use glob :)
> 
> Actually no because glob() doesn't traverse a directoy structure, it
> works on a single directory only (or if you use a wildcard as a
> directory name then on a single level of directories).

I don't know whether perl's glob supports it, but using "**" instead of
"*" means, for many shells, traverse as many directory levels as
necessary.


-- 
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}


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

Date: Sun, 06 Apr 2003 00:09:19 GMT
From: * Tong * <sun_tong@users.sourceforge.net>
Subject: Perl module builder
Message-Id: <PeKja.6807$DD6.1242607@news20.bellglobal.com>

Hi,

I know that I can use h2xs to create a first blue print of my Perl
module. My consideration is those user configurable variables,
init/set/get them are pretty the same for every variable. 

So I'm wondering if there has already been a tools out there that
does that for me, ie, populate the script with user configurable
variables init/set/get, etc. 

thanks

-- 
Tong (remove underscore(s) to reply)
  *niX Power Tools Project: http://xpt.sourceforge.net/
  - All free contribution & collection


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

Date: 5 Apr 2003 20:05:12 -0800
From: viijv@thedifferenZ.com (Vijoy Varghese)
Subject: Re: PHP Code to PERL conversion...
Message-Id: <4c08aaff.0304052005.44ef4f89@posting.google.com>

I want this stuff for free, this is for a non-profit
website(educational purpose) and i am a student of that institute. And
i am doing the web-interface development as my acadamic project.

Vijoy~

tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrnb8un43.6ca.tadmc@magna.augustmail.com>...
> Vijoy Varghese <viijv@thedifferenZ.com> wrote:
> 
> > The new php function is like this
> > // MD5 Encryption
> > function md5_hmac($data, $key)
> > {
> > 	if (strlen($key) > 64)
> > 		$key = pack('H*', md5($key));
> > 	$key  = str_pad($key, 64, chr(0x00));
> > 
> > 	$k_ipad = $key ^ str_repeat(chr(0x36), 64);
> > 	$k_opad = $key ^ str_repeat(chr(0x5c), 64);
> > 
> > 	return md5($k_opad . pack('H*', md5($k_ipad . $data)));
> > }
> > 
> > Can some one translate this to perl?
> 
> 
> Yes.


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

Date: Sat, 05 Apr 2003 22:12:12 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: PHP Code to PERL conversion...
Message-Id: <87adf4gt7n.fsf@limey.hpcc.uh.edu>

>> On 5 Apr 2003 20:05:12 -0800,
>> viijv@thedifferenZ.com (Vijoy Varghese) said:

> I want this stuff for free, this is for a non-profit
> website(educational purpose) and i am a student of that
> institute. And i am doing the web-interface development
> as my acadamic project.

So you want someone else to do your work for you for free.
I think you need to revise your expectations of the world
somewhat.


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

Date: Sun, 06 Apr 2003 09:43:05 GMT
From: "Ian.H [dS]" <ian@WINDOZEdigiserv.net>
Subject: Re: PHP Code to PERL conversion...
Message-Id: <vitv8v8k0gs7m26m8hgc6f1b6ikhbgmp1k@4ax.com>
Keywords: Remove WINDOZE to reply

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

[ rearranged into correct chronological order ]


> 
> tadmc@augustmail.com (Tad McClellan) wrote in message
> news:<slrnb8un43.6ca.tadmc@magna.augustmail.com>... 
> > Vijoy Varghese <viijv@thedifferenZ.com> wrote:
> > 
> > > The new php function is like this
> > > // MD5 Encryption
> > > function md5_hmac($data, $key)


[ snip ]


> > > Can some one translate this to perl?
> > 
> > 
> > Yes.


In a fit of excitement on 5 Apr 2003 20:05:12 -0800,
viijv@thedifferenZ.com (Vijoy Varghese) managed to scribble:

> I want this stuff for free, this is for a non-profit
> website(educational purpose) and i am a student of that institute.
> And i am doing the web-interface development as my acadamic
> project.
> 
> Vijoy~


So learn to code in Perl then, problem solved.. no?



Regards,

  Ian

-----BEGIN xxx SIGNATURE-----
Version: PGP 8.0

iQA/AwUBPo/2nGfqtj251CDhEQLJAACg9Z6r8P1aD/Lh8P+bKPbpYe7BlKAAn3e4
UyM2nJwEGn6n1AtCdqu5U08P
=8y7q
-----END PGP SIGNATURE-----

-- 
Ian.H  [Design & Development]
digiServ Network - Web solutions
www.digiserv.net  |  irc.digiserv.net  |  forum.digiserv.net
Scripting, Web design, development & hosting.


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

Date: 6 Apr 2003 03:35:27 -0700
From: viijv@thedifferenZ.com (Vijoy Varghese)
Subject: Re: PHP Code to PERL conversion...
Message-Id: <4c08aaff.0304060235.3822dd5@posting.google.com>

No Tony,

I fixed the problem myself, instead of changing my cgi/perl programs i
changed the php code :-) to adapt with my cgi/perl website.

thanking all of you,

Regards
Vijoy~


Tony Curtis <tony_curtis32@yahoo.com> wrote in message news:<87adf4gt7n.fsf@limey.hpcc.uh.edu>...
> >> On 5 Apr 2003 20:05:12 -0800,
> >> viijv@thedifferenZ.com (Vijoy Varghese) said:
>  
> > I want this stuff for free, this is for a non-profit
> > website(educational purpose) and i am a student of that
> > institute. And i am doing the web-interface development
> > as my acadamic project.
> 
> So you want someone else to do your work for you for free.
> I think you need to revise your expectations of the world
> somewhat.


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

Date: Sun, 6 Apr 2003 09:18:18 +1000
From: "Tintin" <me@privacy.net>
Subject: Re: Reformated Why won't this work.
Message-Id: <b6no7r$7906g$1@ID-172104.news.dfncis.de>


"Josh Morrison" <Verbalx2@hotmail.com> wrote in message
news:djDja.53032$0X.10716065@twister.columbus.rr.com...
> I've only been coding in perl for now, 2 weeks.  I'm not good.  I'll be
the
> first one to admit to it.  And I've been working off what I have, which is
> pretty bad I know.  I'm not claiming any superior knowledge here, that's
> more than apparent.
>
> I'm asking if I should change all of the OUTPUT to INPUT or just where you
> pointed it out?
>
> I've come across a load more problems with it and I'm pretty much on the
> side of giving up on Perl and the script.  I guess with everyone's
> professional comments, I'm way out of my league.

The *biggest* favour you can do for yourself, is to read the posting
guidelines (like you've been asked many times).  This requires absolutely no
Perl knowledge and will help you survive in the world of Usenet without
being killfiled.




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

Date: Sun, 06 Apr 2003 10:19:32 GMT
From: inwap@inwap.com (Joe Smith)
Subject: Re: Simple, but I can't figure it out.
Message-Id: <UaTja.7326$io.274968@iad-read.news.verio.net>

In article <8e213620.0303241417.7ca82de2@posting.google.com>,
Corey Andrews <matirxrabbit@Hotmail.com> wrote:
>Here's the scenario. I am creating news posting script, and every time
>someone enters in a new news entry to a file, I have it so the news
>entry will be assigned a different # each time, and that # will write
>out to the beginning of a separate file, thus, the most #s being at
>the beginning of the file, and the oldest, at then end. Now I just
>want to create a script that will display the archive of news #s, but
>only the most recent (first 20). So, I just need to print out the
>first 20 lines of the file.  But only 20 lines, so every time I add a
>new #, the last # gets booted out.

Personally, I would append new numbers to the end of a file, then
print the last 20 items in reverse order.  (Appending is often
safer than rewriting in a multi-process environment.)

	@numbers = <IN>;
	@last_20 = @numbers[-20..-1];
	@newest_1st = reverse @last_20;
	print @newest_1st;

		-Joe
-- 
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.


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

Date: Sat, 5 Apr 2003 21:07:19 -0600
From: "Hiro Asari" <hiro@asari.net>
Subject: Re: Substitution won't match for me
Message-Id: <v8v6f6arua00b5@corp.supernews.com>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1


"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrnb8umve.6ca.tadmc@magna.augustmail.com...
> Hiro Asari <hiro@asari.net> wrote:
> > "Steve Ferson" <daNOSPAM_beano@hotmail.com> wrote in message
> > news:m1Aja.173$Kc3.26@newsfep3-gui.server.ntli.net...
>
>
> >> $input =~ s/(<message>.*)\n(.*<\/message>)/$1<br\/>$2/gsx;
>
> > I'm
> > guessing that you want the /m modifier instead of /s.
>
>
> That cannot possibly be the problem.
>
> the /m modifier changes the meaning of the ^ and $ anchors, and
> the OP's pattern does not use those anchors, so /m would be a
no-op.
>
>
> --
>     Tad McClellan                          SGML consulting
>     tadmc@augustmail.com                   Perl programming
>     Fort Worth, Texas

Tad, you seem to be confusing the problem and the solution.  I'd
identified the problem earilier in my post.  The solution, however,
was half-baked and wrong, as you pointed out.

Someone else proposed a solution earlier, but in the spirit of
TMTOWTDI, here's another solution.

$input =~ s/<message>(.*?)<\/message>/
        $_=$1; s[\n][<br\/>]gs; $output
 .='<message>'.$_.'<\/message>'
        /gsex;

After this, $output should contain what OP is looking for.  (Well,
more or less...some \n's are lost.)

-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32) - GPGOE 0.4.1

iD8DBQE+j5nnoXhPvmJPsrERAieqAJ9sx28c4rQRM4T99PkwynzV7CQMBwCfVru9
gNGGZ7liM6s5mYp43MKitVk=
=49Ja
-----END PGP SIGNATURE-----




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

Date: Sun, 06 Apr 2003 12:08:24 GMT
From: "primo" <primo.lgz@tiscali.it>
Subject: transfera file server to server
Message-Id: <YMUja.85616$i26.2599061@news2.tin.it>

There are the faculty in CGI/Perl to transfer a file from a remote server to
a new remote server?

for exemple:

I have "file.htm" in a serverA (url: http://www.old.com )
location (/user/www/)
I want transfer it in a serverB (url: http://www.new.com)
location (/utent/www/)

How can I do?
Thank'you.





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

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.  

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 4821
***************************************


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