[22468] in Perl-Users-Digest
Perl-Users Digest, Issue: 4689 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 10 14:08:13 2003
Date: Mon, 10 Mar 2003 11:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 10 Mar 2003 Volume: 10 Number: 4689
Today's topics:
Re: A Good Perl Developing Enviroment info@wienerlibrary.co.uk
ANNOUNCE: List-Compare-0.16 <jkeen@concentric.net>
binary template for OMF? (Lars Unrotin)
can't download ActivePerl-5.8.0 <gm@magpage.com>
Re: can't download ActivePerl-5.8.0 <ian@WINDOZEdigiserv.net>
Re: can't download ActivePerl-5.8.0 <bernard.el-hagin@DODGE_THISlido-tech.net>
Re: can't download ActivePerl-5.8.0 <gm@magpage.com>
Re: CGI qw(-unique_headers) ?? <simon.oliver@nospam.umist.ac.uk>
Newbie: Extract info from MSI <ncremployee@ncr.com>
Perl Script or Bourne Shell for a Cisco router, Please (eugene123)
Re: Perl Script or Bourne Shell for a Cisco router, Ple <olivier.martin.remove-nospam@videotron.ca>
Re: Perl Script or Bourne Shell for a Cisco router, Ple <pjml@nerc.ac.uk.loopback>
Re: Perl Script or Bourne Shell for a Cisco router, Ple <ccnp@mail.pt>
Re: Perl Script or Bourne Shell for a Cisco router, Ple <pick@redhat.com>
Re: perlcc error (cl and link) (Bryan Castillo)
Re: Prefix matching for filenames? <rev_1318@hotmail.com>
Re: Prefix matching for filenames? <fxn@hashref.com>
Re: Re to all <humrattle@hotmail.com>
Re: Re to all <noreply@gunnar.cc>
Re: Redirect with links stored in external txt file (Maria Kovacs)
Re: Redirect with links stored in external txt file (Helgi Briem)
Re: Redirect with links stored in external txt file <flavell@mail.cern.ch>
Re: remove anything from string except two words (Pynex)
Re: remove anything from string except two words <noreply@gunnar.cc>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 10 Mar 2003 17:10:08 +0000
From: info@wienerlibrary.co.uk
Subject: Re: A Good Perl Developing Enviroment
Message-Id: <4tgp6vsrvrrmcahqmp352p3g3pge06gguk@4ax.com>
On Sat, 18 Jan 2003 04:17:18 GMT, "A. Fuentes" <alvarof2@hotmail.com>
wrote:
>
This might be a bit late but:
If you're developing on PC or Linux then the only IDE that I've heard
of is Perl Builder from Soution soft.
check out www.solutionsoft.com
------------------------------
Date: Mon, 10 Mar 2003 18:23:51 GMT
From: "James E Keenan" <jkeen@concentric.net>
Subject: ANNOUNCE: List-Compare-0.16
Message-Id: <81f54750c26e8a761be3d48d828108bf@news.teranews.com>
A new version of Perl module List::Compare, v0.16, has been uploaded
to CPAN.
In earlier versions, when comparing two lists for relationships such
as union, intersection, etc., List::Compare always returned an array
holding that union, intersection, etc.
@union = $lc->get_union();
In this version, the user has the option of simply requesting that a
reference to such an array be returned.
$union_ref = $lc->get_union_ref();
This will be useful if the user doesn't need the comparison array for
its own sake but for the sake of plugging into some further
computation.
List::Compare v0.16 has so far been installed on Win32 (Win98 SE) and
RH Linux 7.2. The author would welcome comments on installation on
other platforms. Thank you very much.
------------------------------
Date: 10 Mar 2003 10:55:51 -0800
From: spammy@ridiculopathy.com (Lars Unrotin)
Subject: binary template for OMF?
Message-Id: <903e0b6b.0303101055.5ad5bfd4@posting.google.com>
I've been working on a perl script to interpret OMF files [Open Media
Framwework, not scrollkeeper docs]. I'm new to unpacking binaries, so
I've tried several different templates with only a little luck.
I've looked for a spec of this file type [supposedly an open standard]
and have had no luck.
Is there a method in perl for figuring out how to interpret a binary
file? I've had no experience in this regard and would appreciate any
suggestions.
Thank you.
------------------------------
Date: 10 Mar 2003 13:53:45 GMT
From: "~greg" <gm@magpage.com>
Subject: can't download ActivePerl-5.8.0
Message-Id: <b4i5d9$fnd$0@216.155.32.49>
I'm using a 56k modem, and it
keeps getting stuck at 204KB or 211KB (--of 11.3MB)
It doesn't just slow down, it stops.
( --but just the "MSI" -- the "AS package" seems like
it might download. )
------------------------------
Date: Mon, 10 Mar 2003 13:55:55 GMT
From: "Ian.H [dS]" <ian@WINDOZEdigiserv.net>
Subject: Re: can't download ActivePerl-5.8.0
Message-Id: <ja6p6v0cfu1195c7dc7bjivaailvkmqtje@4ax.com>
Keywords: Remove WINDOZE to reply
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
In a fit of excitement on 10 Mar 2003 13:53:45 GMT, "~greg"
<gm@magpage.com> managed to scribble:
> I'm using a 56k modem, and it
> keeps getting stuck at 204KB or 211KB (--of 11.3MB)
> It doesn't just slow down, it stops.
> ( --but just the "MSI" -- the "AS package" seems like
> it might download. )
And this is a Perl related question in what way?
Regards,
Ian
-----BEGIN xxx SIGNATURE-----
Version: PGP 8.0
iQA/AwUBPmyZZ2fqtj251CDhEQLzKwCgoiW5fs4H+ftPlXsxaSwncafqZ9UAninz
vhSK0UcKRNdLCZu3FmoPpLI7
=kruO
-----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: Mon, 10 Mar 2003 14:02:08 +0000 (UTC)
From: "Bernard El-Hagin" <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: can't download ActivePerl-5.8.0
Message-Id: <Xns933A9837589B6elhber1lidotechnet@62.89.127.66>
~greg wrote:
> I'm using a 56k modem, and it
> keeps getting stuck at 204KB or 211KB (--of 11.3MB)
> It doesn't just slow down, it stops.
> ( --but just the "MSI" -- the "AS package" seems like
> it might download. )
So?
--
Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'
------------------------------
Date: 10 Mar 2003 17:22:35 GMT
From: "~greg" <gm@magpage.com>
Subject: Re: can't download ActivePerl-5.8.0
Message-Id: <b4ihkr$f0n$0@216.155.32.49>
My apologies to alt.lang.perl.misc,
for the curt way I put my question,
and for the inappropriateness of the
question to this ng.
My excuses are these:
Whenever I try to download a large file like that
and it gets stuck - always at the same place - and
especially since I had no problem downloading
an equally large file from the same site, - I suspect
it's got something to do with either the server,
or with the file's compression being corrupted.
And I thought that 1); perl people are the ones who would
have had the experience with cgi etc to know why these
things happen, when they do, in general, and could therefore
enlighten me about that. And that 2); perl people are exactly
the people who would either have had the same problem,
or not have had any problem, with that particular file from
ActiveState Perl -- and I'd appreciate anyone saying so,
either way.
Perhaps the demand for the file is simply too heavy right now.
Or perhaps ActiveState actively cuts off downloads to slow
modems. Or perhaps they didn't like the personal information
I gave them. Or perhaps the problem I had has something to
do with file type vs my fire-wall. I really have no idea why.
But I really do want the new ActivePerl -- eg, for the
switch-statement module.
However, I certainly withdraw the question from here,
--and also the nasty post I was going to write --
because I did just look over some other posts to this
group and I get the point.
I seen now that this group -- alt.lang.perl.misc --
has the emphasis on the "lang" - meaning syntax and semantics, --
- and in particular miscelaneous issues about the perl language
-- vs for example cgi programing or objects and modues etc.
(or tee-shirts and parties, - or downloading ActivePerl)
Whereas I had been interpreting "alt.lang.perl.misc"
with an emphasis on "misc" -- "lang" being simply
a sensible redundancy to distinguish this "perl"
from other "perls" -- a sensible redundancy
in the sense that 'perl' is after all a subtle
spelling distinction, and sensible in view
of the horrid spellings to be found in so
many other news group names -- lest anyone
mistake this 'perl' for a misspelling-- the 'lang.perl'.
But I think I really thought so - that this was "misc"
- simply because this seems to be the most
active perl group.
Below is the list of ng names available to me
that have "perl" in them. None of them seem
really appropriate for very general questions
such as mine was. But perhaps the appropriate
one can be pointed out?
In anycase I won't ask such questions here again.
(eg the other one that I want to ask -somewhere
- about problems to do with installing perl 5.8.0 over 5.6.1. )
btw - no offense taken.
And none intended on my part.
~Greg.
alive.internet.lang.perl
alt.binaries.pictures.erotica.perl-geeks
alt.comp.lang.superlang
alt.comp.perl.cancelbots
alt.crimehip.lang.perl
alt.flame.marshal.perlman
alt.flame.marshal.perlman.weenie
alt.fr.langages.perl
alt.h.i.p.c.r.i.m.e.lang.perl
alt.h1pcr1me.lang.perl
alt.h2.pcr2me.lang.perl
alt.hh.ii.pp.cc.rr.ii.mm.ee.lang.perl
alt.hipclone.lang.perl
alt.hipcrime.lang.perl
alt.music.perl-jam
alt.perl
alt.perl.flame
alt.perl.sockets
cn.bbs.comp.lang.perl
cn.comp.lang.perl
comp.lang.perl
comp.lang.perl.announce
comp.lang.perl.m
comp.lang.perl.misc
comp.lang.perl.moderated
comp.lang.perl.modules
comp.lang.perl.tk
cz.comp.lang.perl
de.alt.talk.liebe.koerperlich
de.comp.lang.perl
de.comp.lang.perl.cgi
de.comp.lang.perl.misc
dk.edb.programmering.perl
eug.comp.lang.perl
fa.irc.operlist
fido7.ru.cgi.perl
fido7.ru.cgi.perl.chainik
fido7.ru.perlowka
fj.comp.lang.perl
fj.lang.perl
fr.comp.lang.perl
gaia.fido.perl
gated.perl.fwp
han.comp.lang.perl
hanse-ml.libwww-perl
hanse-ml.msq|perl.announce
hut.lists.perl5-porters
it.comp.lang.perl
japan.comp.lang.perl
jmjas.ml.perl-win32-j
jmas.ml.perl-xml
kiva.lists.modperl
linux.debian.maint.perl
list.perl5-porters
lists.operlist
lists.perl5-porters
mail.operlist
mail.perl5-porters
mailing.unix.embperl
mailing.unix.modperl-doc
mailing.unix.modperl-doc-cvx
mailing.unix.modperl-users
mgate.perl5-porters
mgate.perldbi.dev
mgate.perldbi.users
microsoft.public.activex.programming.hyperlinking
microsoft.public.inetsdk.programming.hyperlinkng_api
msu-nj.dept.perls.tr
news.groups.lang.perl.moderated
news.misc.lang.perl.announce
nlo.lists.xchat-perl
no.it.programmering.perl
no.perl
novell.devsup.perl
pep.gsep.ed633.perloff-online
pep.gsep.ed654.perloff99
pep.gsep.ed654.spring99-perloff
pep.gsep.ed654b.perloff
pep.gsep.ed655.perloff
perl.beginners.cgi
perl.copenhagen
perl.cpan.testers
perl.cvs.parrot
perl.daily-build.reports
perl.daily.news
perl.dbi.dev
perl.dbi.users
perl.fwp
perl.golf
perl.inline
perl.ithreads
perl.jobs
perl.jobs.discuss
perl.libwww
perl.macosx
perl.macperl
perl.makemaker
perl.module-authors
perl.modules
perl.perl5.changes
perl.perl5porters
perl.perl6.internals
perl.perl6.language
perl.poe
perl.ports-gw
perl.qa
perl.qpsmtpd
perl.unicode
perl.vmsperl
perl.xs
pl.comp.lang.perl
rainbow.mailing-lists.perl5.tk
relcom.comp.lang.perl
rpi.mail.irc-operlist
sdm.lists.perl-tk
sslug.perl
tw.bbs.comp.lang.perl
unl.physics.paperless
usg.lang.perl
------------------------------
Date: Mon, 10 Mar 2003 15:37:37 +0000
From: Simon Oliver <simon.oliver@nospam.umist.ac.uk>
Subject: Re: CGI qw(-unique_headers) ??
Message-Id: <3E6CB141.4010907@nospam.umist.ac.uk>
Christopher J. White wrote:
> I've it documented somewhere that to get only
> one set of headers printed, use the following:
>
> use CGI qw(-unique_headers);
>
> Is this still valid?
It's in the source code of CGI.pm:
# Change this to 1 to suppress redundant HTTP headers
$HEADERS_ONCE = 0;$HEADERS_ONCE++,
...
$HEADERS_ONCE++, next if /^[:-]unique_headers$/;
--
Simon Oliver
------------------------------
Date: Mon, 10 Mar 2003 13:59:40 -0500
From: "NCR Employee" <ncremployee@ncr.com>
Subject: Newbie: Extract info from MSI
Message-Id: <3e6ce09c$1@rpc1284.daytonoh.ncr.com>
Hello everyone:
I tried to extract info from MSI (Microsoft Windows Installer) file. If you
have any info/pointer related to this subject please show/forward it to me.
Many thanks in advance.
My email address is kp100012@ncr.com
Khue Pham
------------------------------
Date: 10 Mar 2003 07:59:08 -0800
From: mdargin@msn.com (eugene123)
Subject: Perl Script or Bourne Shell for a Cisco router, Please Help??
Message-Id: <620f649f.0303100759.62cbdea3@posting.google.com>
I would like to send a script out on my server to make some
configuation changes on 25 Cisco routers.
I need to enter this command on the 25 Cisco routers.
ntp server 10.2.3.1
ip name server 10.1.5.6
So basically I need to write a script (Perl or Bourne) to telnet to
each of the 25 routers, use the default vty and enable password and go
into config mode to enter in the commands and then to exit out of the
router and then telnet to the next router for the next sequence.
Command sequence for router 1 for the script ( this is what I want the
script to do )
Command: telnet x.x.x.x
<enter vty password> I want the script to enter this password: bankee
Command: enable
<enter enable password> I want the script to enter this password:
cisco
Command: config t
Command: ntp server 10.2.3.1
Command: ip name server 10.1.5.6
Command: end
Command: exit
I appreciate any responses. Thank You in Advanced
------------------------------
Date: Mon, 10 Mar 2003 11:08:16 -0500
From: "Olivier Martin" <olivier.martin.remove-nospam@videotron.ca>
Subject: Re: Perl Script or Bourne Shell for a Cisco router, Please Help??
Message-Id: <3e6cb853_1@news3.prserv.net>
You can use the "expect" scripting language... for example :
#!/usr/local/bin/expect -f
#
set hostname [lindex $argv 0]
spawn telnet $hostname
# expect "Username: "
# send "whatever_username_\r" if you are using TACACS / RADIUS
expect "Password: "
send "yourpassword\r"
expect ">"
send "en\r"
expect "Password: "
send "your-enable-pass\r"
expect "#"
send "your command\r"....... and so on.
send "exit\r"
Using korn shell (or whatever other shell script) :
#!/usr/bin/ksh
host $1 >/dev/null 2>&1
# Verify if the host given as an argument is an existing host
if [ $? -eq 0 ]
then
{
echo your-password
echo en
echo your-enable-password
echo config terminal
echo your command....
# sleep is necessary or else the telnet pipe ends too fast.. so have
the required amount of time to input each commands here...
sleep 5
} | telnet $1
exit 0
else
echo
echo "Usage : $0 hostname"
echo
exit 1
fi
Calling thi sscript using another script looping for each hostname (or ip
address) with minor modification will make it !
Olivier
"eugene123" <mdargin@msn.com> wrote in message
news:620f649f.0303100759.62cbdea3@posting.google.com...
> I would like to send a script out on my server to make some
> configuation changes on 25 Cisco routers.
>
> I need to enter this command on the 25 Cisco routers.
>
> ntp server 10.2.3.1
> ip name server 10.1.5.6
>
> So basically I need to write a script (Perl or Bourne) to telnet to
> each of the 25 routers, use the default vty and enable password and go
> into config mode to enter in the commands and then to exit out of the
> router and then telnet to the next router for the next sequence.
>
> Command sequence for router 1 for the script ( this is what I want the
> script to do )
>
> Command: telnet x.x.x.x
> <enter vty password> I want the script to enter this password: bankee
> Command: enable
> <enter enable password> I want the script to enter this password:
> cisco
> Command: config t
> Command: ntp server 10.2.3.1
> Command: ip name server 10.1.5.6
> Command: end
> Command: exit
>
> I appreciate any responses. Thank You in Advanced
------------------------------
Date: Mon, 10 Mar 2003 16:10:26 +0000
From: PJML <pjml@nerc.ac.uk.loopback>
Subject: Re: Perl Script or Bourne Shell for a Cisco router, Please Help??
Message-Id: <3E6CB8F2.A019F8BB@nerc.ac.uk.loopback>
eugene123 wrote:
>
> I would like to send a script out on my server to make some
> configuation changes on 25 Cisco routers.
>
> I need to enter this command on the 25 Cisco routers.
>
> ntp server 10.2.3.1
> ip name server 10.1.5.6
>
> So basically I need to write a script (Perl or Bourne) to telnet to
> each of the 25 routers, use the default vty and enable password and go
> into config mode to enter in the commands and then to exit out of the
> router and then telnet to the next router for the next sequence.
>
> Command sequence for router 1 for the script ( this is what I want the
> script to do )
>
> Command: telnet x.x.x.x
> <enter vty password> I want the script to enter this password: bankee
> Command: enable
> <enter enable password> I want the script to enter this password:
> cisco
> Command: config t
> Command: ntp server 10.2.3.1
> Command: ip name server 10.1.5.6
> Command: end
> Command: exit
>
> I appreciate any responses. Thank You in Advanced
Have a look at the "expect" command - type "man expect" on any
self-respecting Unix system...
//Pete L//
------------------------------
Date: Mon, 10 Mar 2003 16:26:24 +0000
From: ccnp <ccnp@mail.pt>
Subject: Re: Perl Script or Bourne Shell for a Cisco router, Please Help??
Message-Id: <pan.2003.03.10.16.26.12.181258.19095@mail.pt>
There is also Expect module for Perl for more advanced purposes!
On Mon, 10 Mar 2003 15:59:08 +0000, eugene123 wrote:
> I would like to send a script out on my server to make some configuation
> changes on 25 Cisco routers.
>
> I need to enter this command on the 25 Cisco routers.
>
> ntp server 10.2.3.1
> ip name server 10.1.5.6
>
> So basically I need to write a script (Perl or Bourne) to telnet to each
> of the 25 routers, use the default vty and enable password and go into
> config mode to enter in the commands and then to exit out of the router
> and then telnet to the next router for the next sequence.
>
> Command sequence for router 1 for the script ( this is what I want the
> script to do )
>
> Command: telnet x.x.x.x
> <enter vty password> I want the script to enter this password: bankee
> Command: enable
> <enter enable password> I want the script to enter this password: cisco
> Command: config t
> Command: ntp server 10.2.3.1
> Command: ip name server 10.1.5.6
> Command: end
> Command: exit
>
> I appreciate any responses. Thank You in Advanced
------------------------------
Date: Mon, 10 Mar 2003 11:32:32 -0500
From: pick <pick@redhat.com>
Subject: Re: Perl Script or Bourne Shell for a Cisco router, Please Help??
Message-Id: <b4ifdi$t7j$1@stan.redhat.com>
http://search.cpan.org/author/JWIED/Cisco-Conf-0.10/
ccnp wrote:
> There is also Expect module for Perl for more advanced purposes!
>
>
> On Mon, 10 Mar 2003 15:59:08 +0000, eugene123 wrote:
>
>
>>I would like to send a script out on my server to make some configuation
>>changes on 25 Cisco routers.
>>
>>I need to enter this command on the 25 Cisco routers.
>>
>>ntp server 10.2.3.1
>>ip name server 10.1.5.6
>>
>>So basically I need to write a script (Perl or Bourne) to telnet to each
>>of the 25 routers, use the default vty and enable password and go into
>>config mode to enter in the commands and then to exit out of the router
>>and then telnet to the next router for the next sequence.
>>
>>Command sequence for router 1 for the script ( this is what I want the
>>script to do )
>>
>>Command: telnet x.x.x.x
>><enter vty password> I want the script to enter this password: bankee
>>Command: enable
>><enter enable password> I want the script to enter this password: cisco
>>Command: config t
>>Command: ntp server 10.2.3.1
>>Command: ip name server 10.1.5.6
>>Command: end
>>Command: exit
>>
>>I appreciate any responses. Thank You in Advanced
------------------------------
Date: 10 Mar 2003 08:50:23 -0800
From: rook_5150@yahoo.com (Bryan Castillo)
Subject: Re: perlcc error (cl and link)
Message-Id: <1bff1830.0303100850.251efc6f@posting.google.com>
> Oh wait I need visual C installed? I though perl came with it
Perl, come with Visual C, hmmm... How much would you be paying for
perl then?
You never really stated how you were using perl. If you are trying to
compile a new module that has C in it, you will need a compiler. If
you don't want to use MS VC, you could use gcc (an open-source
compiler), but then you should compile perl yourself.
You might check to see if the module you are compiling is available
(pre-compiled) through the PPM utility (installed with ActiveState).
>
>
> > > > this is the error I get, I'm using active perl for windows.
> > > >
> > > > 'cl' is not recognized as an internal or external command,
> > > > operable program or batch file.
> > > > 'link' is not recognized as an internal or external command,
> > > > operable program or batch file.
> > > >
> > > >
> > > > anyone know what's going on?
> > >
> > >
> > > cl is the cmdline version of M$VC++ AFAIK. I assume 'link' has
> > > something to do with that too. Either they're not installed, or not
> > > in your %PATH%.
> >
> > You can look at this batch file to see how your environment should be
> > set for compiling and linking with MS. (substitute your install dir
> > though)
> >
> > C:\Program Files\Microsoft Visual Studio\VC98\Bin\Vcvars32.bat
------------------------------
Date: Mon, 10 Mar 2003 16:50:23 +0100
From: "Paul van Eldijk" <rev_1318@hotmail.com>
Subject: Re: Prefix matching for filenames?
Message-Id: <pan.2003.03.10.15.50.19.667151@hotmail.com>
On Fri, 07 Mar 2003 10:41:04 -0800 jtd wrote:
> I have a directory with tens of thousands of files with numbers as
> filenames:
>
> 00010.dat
> 00039.dat
> 00072.dat
> 00118.dat
> ...
> 30301.dat
>
> Given a number, say 00092, how can I efficiently find the largest
> filename that is less than or equal to the number? In this example,
> the answer is 00072.dat. I'm using Reiserfs, so the number of files is
> not a problem.
>
This should work:
#!/usr/bin/perl
use warnings;
use strict;
chomp(my $number = <>);
my $file;
until ( $file = sprintf("%05d",$number) . ".dat" , -e $file ) { $number-- }
print "highest available file is: $file\n";
HTH
Paul
--
$_=q{ ^4;c;14;1b:a^5;16:c^17:e^a;11;19:h^9;15:j^0:k^18:l^13
:n^6:o^7:p^10:r^b;12;1a:s^2:t^3;8:u^1};s{(?<=[;^])(\d)?([\d
abc])}{$a=$1;$2=~/([abc])/?$a*13+ord($1)%87:$1*13+$2}egx;
for(split/:/){($a,@_)=split/[;^]/;@@[@_]=($a)x@_}print@@
------------------------------
Date: Mon, 10 Mar 2003 16:25:07 +0000 (UTC)
From: Xavier Noria <fxn@hashref.com>
Subject: Re: Prefix matching for filenames?
Message-Id: <b4ie93$tf6$1@news.ya.com>
Sorry, for the double quoting, my news server does not have the original
message.
: On Fri, 07 Mar 2003 10:41:04 -0800 jtd wrote:
:
:> I have a directory with tens of thousands of files with numbers as
:> filenames:
:>
:> 00010.dat
:> 00039.dat
:> 00072.dat
:> 00118.dat
:> ...
:> 30301.dat
:>
:> Given a number, say 00092, how can I efficiently find the largest
:> filename that is less than or equal to the number? In this example,
:> the answer is 00072.dat. I'm using Reiserfs, so the number of files is
:> not a problem.
##
## untested, assumes cwd is the one with the files
##
# parameter
my $thr = shift;
my @idxs = sort { $a <=> $b } # sort them in numerical ascending order
grep { $_ <= $thr } # filter them by threshold
map { /^(d+)/ } # extract indexes
glob('*.dat'); # slurp file names
my $wanted_file = sprintf "%05d.dat", $idx[-1]; # take the rightest
-- fxn
------------------------------
Date: Mon, 10 Mar 2003 17:09:49 +0100
From: "Hum Rattle" <humrattle@hotmail.com>
Subject: Re: Re to all
Message-Id: <b4idbp$214bqj$1@ID-63849.news.dfncis.de>
> I don't believe you.
> Are you seriously claiming that you are using WebTV or some other device
> that doesn't have any shell as your software development platform?
Eever heard of webspace with just a ftp account and no shell access?
> Then go, no better run, to your nearest used computer dealer and get an
old
> 486 running Windows95. Actually people are happy to give them away for
free
> such that they don't have to pay the recycling fee. Even that crummy piece
> would be a major improvment over your current situation and is totally
> sufficient to develop and test Perl programs.
what has this to do with the problem? you just answered my question in
posting
news:7DIaa.2127$qB5.64@nwrddc01.gnilink.net.
greets
hum
------------------------------
Date: Mon, 10 Mar 2003 17:21:09 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Re to all
Message-Id: <b4ie3m$20taq8$1@ID-184292.news.dfncis.de>
Hum Rattle wrote:
> Eever heard of webspace with just a ftp account and no shell access?
I have. :)
But that shouldn't prevent you from being able to see the error messages
from Perl.
You can for instance 'redirect' fatal error messages to the browser
through the command
use CGI::Carp 'fatalsToBrowser';
But even better is to install Perl locally, and test your programs there.
/ Gunnar
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 10 Mar 2003 07:36:08 -0800
From: mariakovacs@lycos.com (Maria Kovacs)
Subject: Re: Redirect with links stored in external txt file
Message-Id: <6f76be22.0303100736.7d3949f@posting.google.com>
I got the program working. The problems were just as Gunnar said.
Thank you very much.
I apologize for the lengthy posting I appreciate all your patience to
go thorugh it with me. I am not a very practiced in posting.
As for Alan, yes we do host on Windows server so I cannot use Apache,
and the server I am redirecting to I have no control over.
It seemed to me that the textfile/cgi type solution would be the
simplest way to solve this problem. This way the only thing I will
ever have to edit is a text file on our server, and I can keep all the
redirect links centralized.
Also, yes, the imagemap is only a mock up screen for the promotional
part, it is not the program. We use this to finalize the layout with a
company thourgh emails without sending .exe files.
Thank you all again,
Maria
------------------------------
Date: Mon, 10 Mar 2003 16:02:24 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: Redirect with links stored in external txt file
Message-Id: <3e6cb6d3.2693655792@news.cis.dfn.de>
On 10 Mar 2003 07:36:08 -0800, mariakovacs@lycos.com (Maria
Kovacs) wrote:
>As for Alan, yes we do host on Windows server so I cannot
>use Apache,
Apache is available for Windows and works well.
It is probably the most popular web server for
Windows.
--
Regards, Helgi Briem
helgi AT decode DOT is
------------------------------
Date: Mon, 10 Mar 2003 17:24:02 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Redirect with links stored in external txt file
Message-Id: <Pine.LNX.4.53.0303101714330.12168@lxplus014.cern.ch>
On Mon, Mar 10, Maria Kovacs inscribed on the eternal scroll:
> I apologize for the lengthy posting I appreciate all your patience to
> go thorugh it with me. I am not a very practiced in posting.
No need to apologise - everyone has to start somewhere, and the key
thing is to learn as much as you can from the exchange. It may well
be that you've fixed the one thing that was wrong, but there were some
more-general points made about appropriate solutions and about
problem-solving technique that I, for one, hope didn't entirely fly
past without notice. (There may be others around here willing to
confirm that?)
> As for Alan, yes we do host on Windows server so I cannot use Apache,
There may be some reason for having to use the server that you use,
but that isn't one of them. What's more, if you were able to migrate
(I always think of it as 'upgrade', but that's just me) to Apache
you'd be learning portable skills.
Installing ActivePerl and Win32 Apache is easy - took me less than 10
minutes - and Indigoperl is even easier.
> and the server I am redirecting to I have no control over.
I wasn't entirely clear whether one of the servers was just your test
platform or where your ultimate production server is meant to be, but
I assure you that the server that runs at the _target_ of your
redirection is of no concern whatever. We only need to discuss
(though it's really OT for this group and would be better on
comp.infosystems.www.authoring.cgi or ...www.servers.ms-windows)
issues concerning the server from which the redirection will occur.
> It seemed to me that the textfile/cgi type solution would be the
> simplest way to solve this problem. This way the only thing I will
> ever have to edit is a text file on our server, and I can keep all the
> redirect links centralized.
Well, I've said what I wanted to say about that. If the CGI script
doesn't turn into a server resource bottleneck then it really doesn't
matter, I suppose.
good luck
------------------------------
Date: 10 Mar 2003 05:59:23 -0800
From: pynex@gmx.de (Pynex)
Subject: Re: remove anything from string except two words
Message-Id: <d57585e5.0303100559.34c5a352@posting.google.com>
>
> $newstring = "is know" if $oldstring =~ /(?=is).*?(?=know)/;
>
> Or:
>
> ( $newstring = $oldstring ) =~ s/.*?(is).*?(know).*/$1 $2/;
>
> John
Thanks for your answer, but I'm sorry. What i've written was not
accurate.
another example:
$oldstring="XZ-6666 XXX Systems Version 5.6(17) Copyright 2002"
Now i want to cut out "XZ-6666" and "Version 5.6(17)".
The XZ- and Version Number aren't the same everytime.
It's always XZ-???? and Version ?.?(??)
What makes it a little bit difficult, the order in which this things
occur, arent't the same evertime.
Sometimes they're like: "Version 5.6(17) Copyright 2002 XXX Systems
XZ-6666"
I'm sorry that i've not written, what i meant.
------------------------------
Date: Mon, 10 Mar 2003 16:19:15 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: remove anything from string except two words
Message-Id: <b4iafh$1snfja$1@ID-184292.news.dfncis.de>
Pynex wrote:
> $oldstring="XZ-6666 XXX Systems Version 5.6(17) Copyright 2002"
>
> Now i want to cut out "XZ-6666" and "Version 5.6(17)".
>
> The XZ- and Version Number aren't the same everytime.
>
> It's always XZ-???? and Version ?.?(??)
>
> What makes it a little bit difficult, the order in which this things
> occur, arent't the same evertime.
>
> Sometimes they're like: "Version 5.6(17) Copyright 2002 XXX Systems
> XZ-6666"
$oldstring =~ s{((?:XZ-\d{4})|(?:Version \d\.\d\(\d\d\)))}
{ $newstring .= $1 . ' '; $1 }ge;
What did you try yourself?
/ Gunnar
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
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 4689
***************************************