[8410] in Perl-Users-Digest
Perl-Users Digest, Issue: 2026 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 4 21:07:29 1998
Date: Wed, 4 Mar 98 18:00:26 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 4 Mar 1998 Volume: 8 Number: 2026
Today's topics:
Re: $1 ? (Mike Stok)
@INC and lib jabedi@its.brooklyn.cuny.edu
Re: A perl question (Abigail)
Re: A specific regular expression... (Abigail)
configure on NT? <robin.bowes@nospam.mcmail.com>
DB_File and READ ONLY <ismithr@info.curtin.edu.au>
Re: differences between v 5.001 & 5.004 schwern@starmedia.net
Re: Display highest number <dean@tbone.biol.sc.edu>
Re: Easy Unix Problem (4 U Guys) <beans@bedford.net>
Help with complex data structures. eheft@dnaco.net
Help with perl, immediate answers wanted! <bblum@earthlink.net>
HELP!?!?!!?!?! How to use $| <pjohnson@wcu.edu>
Is there a cron written in perl for Win32? <cchkxh@ARCO.com>
Re: Log Stats Looking for program (Abigail)
managing databases in perl NOSPAMajm@antopia.com
Re: performance : is "eq" fast & efficient ? schwern@starmedia.net
Re: Perl on MS Personal Web Server (Mark Watson)
Perl script from Unix to Win32 <davezhu@notes.gcmail.com>
Perl+MSQL+remote access (Hasan Diwan)
PerlW32 on NT, cannot use > or | why? <tfoong@patrick.com.au>
Re: QUESTION ! how to fill out referer variable in LWP: (Abigail)
Re: QUIZ: answer and hash slice tutorial (O'Shaughnessy Evans)
Re: regexp (Abigail)
Re: regexp (Mike Stok)
Re: Summing Up Array Values - How Do I? (O'Shaughnessy Evans)
use @records[$index] or $records[$index] ?? (Michael Shavel)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 5 Mar 1998 01:38:21 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: $1 ?
Message-Id: <6dkvmd$79t@news-central.tiac.net>
In article <34FDC980.135@cc.gatech.edu>,
Jeff Stewart <object01@cc.gatech.edu> wrote:
>What are the read-only variables $1, $2, $3, etc.? How are they
>populated?
They are populated if a successful regex has portions of the pattern
enclosed in (). One example from the perlre documentation is:
if (/Time: (..):(..):(..)/) {
$hours = $1;
$minutes = $2;
$seconds = $3;
}
You should probably read the perlre docs to understand what goes on.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: Wed, 04 Mar 1998 19:43:53 -0600
From: jabedi@its.brooklyn.cuny.edu
Subject: @INC and lib
Message-Id: <6dkvvf$g02$1@nnrp1.dejanews.com>
Hi,
I'm very new to perl and its way. I know from reading various posts that the
following will add new perl library paths,
use lib '/new/perl/lib/dir';
However, I'm not very clear on where/when this is used. Is 'use' a shell
command? Is the above command to be included in the Makefile? or some other
configuration file? at compile time? Or perhaps, afterward? Can anyone please
clear my questions? Thanks!
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 5 Mar 1998 00:21:21 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: A perl question
Message-Id: <6dkr61$sj3$1@client2.news.psi.net>
Sebastian Probst (Sebastian_Probst@hp.com) wrote on 1646 September 1993
in <URL: news:34FDB9B0.5CE55DD0@hp.com>:
++ $variable=~s/" "/%20/ge
++
++ should work.
I'd be utterly surprised if it did.
Abigail
--
perl -wleprint -eqq-@{[ -eqw+ -eJust -eanother -ePerl -eHacker -e+]}-
------------------------------
Date: 5 Mar 1998 00:29:42 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: A specific regular expression...
Message-Id: <6dkrlm$sj3$2@client2.news.psi.net>
Cliff Heller (fnord@panix.com) wrote on 1646 September 1993 in
<URL: news:upafb6az78.fsf@panix3.panix.com>:
++
++ (.+) at least one of any character
^^^
That's any char *but* a newline.
++ / a slash
++ $ the end of a line.
Then end of the line, or matching just before a newline at the end
of the line.
++
++ So it looks like he's trying to pick out components of a directory name
++ that contains two slashes, at least one of them at the end.
YM: that contains two slashes, each preceded by a non newline character,
where the non newline char of the last slash isn't the other slash,
and with the last slash either the end of the string, or the last
char before a trailing newline.
++ At least that's what it looks like. It may not actually accomplish what
++ he's trying to do in all cases.
I wonder why he doesn't use basename.
Abigail
--
perl -wle '$, = " "; sub AUTOLOAD {($AUTOLOAD =~ /::(.*)/) [0];}
print+Just (), another (), Perl (), Hacker ();'
------------------------------
Date: Tue, 03 Mar 1998 23:52:05 +0000
From: Robin Bowes <robin.bowes@nospam.mcmail.com>
Subject: configure on NT?
Message-Id: <34FC97A5.1B4ECADB@nospam.mcmail.com>
Hi,
Has anyone attempted to port configure to run on NT?
Would this be possible or is it not something for the faint-hearted?
Robin
--
Remove "nospam" from email address to reply.
http://www.redbreast.mcmail.com
Two rules to success in life:
1.Don't tell people everything you know.
-- Sassan Tat
------------------------------
Date: Thu, 05 Mar 1998 09:28:04 +0800
From: Ray Smith <ismithr@info.curtin.edu.au>
Subject: DB_File and READ ONLY
Message-Id: <34FDFFA4.41C6@info.curtin.edu.au>
Hi all,
I am having some problems trying to get a DB_File to open as READ ONLY.
I would like to open several files as read only, used as lookup tables,
keep getting a "Cannot open file databases/courses.db: No such file or
directory" error. Below is the code that I'm using.
#the unit lookup RECNO
#holds unit code : unit name
$course_DB = "databases/courses.db";
$course_rdb = tie @coursedb, "DB_File", $course_DB, DB_RDONLY, 0644,
$DB_RECNO
or die "Cannot open file $course_DB: $!\n";
#the school lookup RECNO
#holds school code : school name
$school_DB = "databases/school.db";
$school_rdb = tie @schooldb, "DB_File", $school_DB, DB_RDONLY, 0644,
$DB_RECNO
or die "Cannot open file $school_DB: $!\n";
The process dies with the No file error. Yet if I change the
"DB_RDOLNY" to "O_RDWR" it all seems to work. Also, I have used the
"DB_RDOLNY" on a $DB_HASH and that seems to also work without problems.
I have also found a few problems in accessing the RECNO arrays, I have
to put in a dummy read, which almost always fails, before reading data
in for the file.
Finally, I would like to lock the files, since some of them (not those
mentioned) will be used for multiple read/writes as part of a CGI. I
have loked at the documentation on flock and read the example that in
the documentation for DB_File, but still can't seem to work out what's
going on. Can someone please send me a dummies version of locking a
file, and also the waiting until the file is unlocked explanation.
Thanks for all your help and time.
--
Ray Smith
Department of Physiotherapy
Curtin University of Technology
Selby St Shenton Park 6008 Aust.
Ph: +61 8 9266 3667
Fax: +61 8 9266 3636
Email: ray@guardian.curtin.edu.au
--
------------------------------
Date: Wed, 04 Mar 1998 18:40:09 -0600
From: schwern@starmedia.net
To: npaci@bigfoot.com
Subject: Re: differences between v 5.001 & 5.004
Message-Id: <6dks80$blu$1@nnrp1.dejanews.com>
Well... first off, you (or your sysadmin) should upgrade from 5.001 to
5.004_04, pronto! Cite some of the more important changes since 5.001:
- 5.001 leaks memory like a seive.
- 5.003 and older have to major security holes:
Buffer overflow (see also INTERNET WORM!):
http://www.cert.org/pub/advisories/CA-97.17.sperl.html
Setuid:
http://www.cert.org/pub/advisories/CA-96.12.suidperl_vul.html
- 5.004 has some new syntax. $coderef->() is one. foreach my $var (...) {}
is another.
- 5.004 comes bundled with alot more modules, notably CGI, File::Copy and
File::Find.
Read the CHANGES document that comes with the source of 5.004_04 to get a
painfully detailed idea of what the changes are.
In article <34FCBF6E.6EF1493F@bigfoot.com>,
npaci@bigfoot.com wrote:
>
> what are the differnces between the versions or where can I look? I
> wrote some code on my mac for a unix machine. The code worked on my
> machine but failed on the unix machine which was running the lesser
> version. It turned out that I had to preface all of my function calls
> with &. Are there other booby traps that anyone can advise me of or
> refer me to a location that documents the differences?
>
> Thanks,
>
> Noah Paci
> npaci@bigfoot.com
>
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 04 Mar 1998 19:03:32 -0500
From: Dean Pentcheff <dean@tbone.biol.sc.edu>
Subject: Re: Display highest number
Message-Id: <87en0igg17.fsf@tbone.biol.sc.edu>
cstewart@flash.net (Chuck Stewart) writes:
> I have a tab delimited file with a name and 10 numbers (dupe number is
> possible).
>
> jack 77 45 45 12 90 etc
> jill 90 44 29 87 34 etc
>
> What I need to do is write to a file jack and jill's highest 3
> numbers. My sort knowledge is limited. Help is appreciated. Thanks
> so much....
print map {m/^([^\t]+)\t*(.*)\s*$/;
join("\t", $1, (reverse sort split(" ", $2))[0..2]), "\n" } <>;
-Dean
--
N. Dean Pentcheff <help@biol.sc.edu>
Biological Sciences, Univ. of South Carolina, Columbia SC 29208 (803-777-3936)
------------------------------
Date: 5 Mar 98 01:41:26 GMT
From: "TomH" <beans@bedford.net>
Subject: Re: Easy Unix Problem (4 U Guys)
Message-Id: <01bd44e2$ed9b0860$269163ce@beans.bedford.net>
I wouldn't use something like this in a production environment, but it's
kind of cute:
-Tom
####################
$_ = "01234567890abcdefghijklmnop";
$#z = -1;
@z = &resplit("", $_, 2); # split every 2 characters
shift @z;
print $#z;
sub resplit {
return (length $_[1]) ? ($_[0], &resplit (unpack ("a$_[2]a9999", $_[1]),
$_[2] ) )
: ();
}
James Ludlow <jdludlow@millcomm.com> wrote in article
<34FC9D3C.5AC05BED@millcomm.com>...
> Elf Sternberg wrote:
> [snip]
> > To those reading this on comp.lang.perl, is there an easier
> > way to split a line 'every nth character' without the cockamamie
> > while/for/substr construction I've got up there? I actually have
> > wracked my brains on this before without coming up with a satisfactory
> > answer.
>
------------------------------
Date: Wed, 04 Mar 1998 19:21:02 -0600
From: eheft@dnaco.net
Subject: Help with complex data structures.
Message-Id: <6dkukk$edm$1@nnrp1.dejanews.com>
Hi
I'm starting to get the feel for perl but building a complex data
structure is eluding me. In C I'd do the following:
typedef struct {
char title[32]; // Title for a List of Items.
int min; // Minimum item
int max; // Maximum item
int numItems; // Number of items in items[]
int *items; // The list of Items.
} trDATA, *tpDATA;
trDATA data[16]; // Allocate 16 lists of items.
Could some kind soul show how to set a similar data structure in perl?
I've hashed out one but its seems really awkward to access say
data[0].items[5] or do a comparison like if (data[0].min < data[1].min)
Thank You.
Eric
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Wed, 04 Mar 1998 17:28:39 +0000
From: Brandon Blum <bblum@earthlink.net>
Subject: Help with perl, immediate answers wanted!
Message-Id: <34FD8F46.A5FF9B1F@earthlink.net>
Hi all, I was wondering if anyone could help me with a problem, well not
really problem but an answer. I wanted to write a form or something that
uses a form, i test them out on my machine with ms dos. Is there anyway
I could use html in that so I could see the form and enter stuff, or do
I need to put it on a webserver which I don't have. If anyone does have
one or a place I could put the scripts I could definetly make out some
kind of deal if you did let me use it!
Thanks,
Brandon
------------------------------
Date: Wed, 04 Mar 1998 16:24:49 +0000
From: Patti Johnson <pjohnson@wcu.edu>
Subject: HELP!?!?!!?!?! How to use $|
Message-Id: <34FD8051.667BDC08@wcu.edu>
This is a multi-part message in MIME format.
--------------FB7C2402249FA46B401578C0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi
I've got a Perl script that writes form data to a file, no frills. But, it
seems to take a notion to insert carriage returns whenever it wills. I see that
the $| thingy is supposed to cause Perl to flush after every write "on the
currently selected output channel." Well, how do I tell it to flush on a a file
handle?
Please answer via email as well as the group, considering the traffic herein.
tia
pj
--------------FB7C2402249FA46B401578C0
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Patti Johnson
Content-Disposition: attachment; filename="vcard.vcf"
begin: vcard
fn: Patti Johnson
n: Johnson;Patti
org: WCU Computer Center
adr: B-10 Forsyth Building;;;Cullowhee;NC;28723;USA
email;internet: pjohnson@wcu.edu
title: Applications Analyst Programmer
tel;work: 704-227-7282
tel;fax: 704-227-7700
note: www3.wcu.edu/~pjohnson/
x-mozilla-cpt: ;0
x-mozilla-html: FALSE
version: 2.1
end: vcard
--------------FB7C2402249FA46B401578C0--
------------------------------
Date: Mon, 2 Mar 1998 18:58:21 GMT
From: Kevin Hawley <cchkxh@ARCO.com>
Subject: Is there a cron written in perl for Win32?
Message-Id: <34FB014C.FF6589BC@ARCO.com>
Hi, I'm looking for cron/crontab functionality for Win32. I have used
perl quite a bit for UNIX system administration, and now I am going to
manage
some Windows 95/NT systems. I have checked the CPAN, but I did not
see what I was looking for, any suggestions?
TIA
-Kevin
(s/nospam/cchkxh/)
p.s.Sorry for posting to this group; Should there be a
...perl....Win32.. group?
------------------------------
Date: 5 Mar 1998 00:38:16 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Log Stats Looking for program
Message-Id: <6dks5o$sj3$3@client2.news.psi.net>
Ron Newton (rknewton@loxinfo.co.th) wrote on 1646 September 1993 in
<URL: news:34fdb7b5.29814909@news.loxinfo.co.th>:
++ I am looking for a LOG file analysis program. Eitrher freeware or
++ Shareware does any one know of such a beast.
A simple, but fast, one:
#!/usr/bin/sh
echo "You got `wc -l /var/http/logs/access_log` hits"
exit
(What has your question to do with Perl?)
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
------------------------------
Date: Wed, 04 Mar 1998 19:39:52 -0600
From: NOSPAMajm@antopia.com
Subject: managing databases in perl
Message-Id: <6dkvnv$fka$1@nnrp1.dejanews.com>
I have a site which offers classified ads. I store the ads in a
tab-delimited text-file database, one entry on each line. The
on-line perl scripts used by visitors for adding, modifying, viewing,
and deleting the ads all just basically read the datafile (having opened and
locked it) into an array, find and process the appropriate line(s), and then
resave the array overwriting the file. The setup works great and seems
robust - the issue now is that there are over 800 lines in the array and
it's getting bigger every day! I'm worried that the datafile will get
so big it will become unwieldy, but I have no idea what this limit is.
Is this setup going to continue to work, or is there a different
approach I could take? One way I've though of is to split the database
into several smaller files which would limit the filesize but would make
datafile management a little more complicated. Any advice would be
appreciated. Please cc email to ajm@antopia.com
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Wed, 04 Mar 1998 18:56:27 -0600
From: schwern@starmedia.net
To: Charles.Bueche@swisscom.com
Subject: Re: performance : is "eq" fast & efficient ?
Message-Id: <6dkt6n$cq9$1@nnrp1.dejanews.com>
In article <34f66f34.3035256@news.unisource.ch>,
Charles.Bueche@swisscom.com (Charles Bueche) wrote:
> The problem is that I have a system (Seagate NerveCenter Pro)
> which generate log files and trim them without my control,
> anytime it decides to do so. I have to read these log files
> and take out the new lines only. I now I could have some sort
> of "tail -f" on them, but the whole is very dynamic. They are
> created, trimmed, added to, and so on.
Hmmm. Well, you could always create a little daemon with File::Tail to
process them as they come.
> I now have take the "heavy but sure" approach where I
> read the file until I get the $stamp I did save from the previous
> run.
>
> If I find if, I rewind and analyze the file from the new
> records. If not, I assume the complete content must be analyzed.
>
> It's not that bad anyway as the whole takes under 10 sec
> and run only once an hour.
Ain't Perl grand that way??? :)
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Thu, 05 Mar 1998 00:35:54 GMT
From: markw@markwatson.com (Mark Watson)
Subject: Re: Perl on MS Personal Web Server
Message-Id: <34fdf27b.31089954@news.sedona.net>
Hello Steve,
re:
>: I've been wrestling with getting PERL to work on an MS Personal Web
>: Server to demo a PERL search engine.
I was going to try this, but a quick search of the web showed a
freely available web server called Xitami from iMatrix that I
really like. It seems very Pearl-friendly, and it is also
available on OS/2, unix, etc. (see: http://www.imatix.com/)
Enjoy!,
Mark
*********************************************
* Mark Watson, author (10 books on AI, *
* Java, and C++) and a Java consultant *
* See www.markwatson.com for Java shareware *
*********************************************
------------------------------
Date: Thu, 5 Mar 1998 09:44:29 +0800
From: "DaveZhu" <davezhu@notes.gcmail.com>
Subject: Perl script from Unix to Win32
Message-Id: <6dl03b$8ce@news.seed.net.tw>
Dear Gentlemen,
I found some Unix-base scripts but I'd like to run those scripts on Win32
system like NT4.0, can this be done ?
Dave Zhu
------------------------------
Date: 4 Mar 1998 19:09:17 -0500
From: hdiwan@shell.clark.net (Hasan Diwan)
Subject: Perl+MSQL+remote access
Message-Id: <6dkqfd$n6h@shell.clark.net>
Keywords: Perl MSQL mSQL SQL remote query off-topic
I have to use a system which has database server mSQL. I want
to be able to run queries against it using perl. Unfortunately, for
security reasons, I cannot physically test my program on the server,
and I would rather not have it crash due to lack of testing.
Is there a way to, using MSQL::RDBMS, run queries remotely
over the network? This may be an MSQL configuration option. If so, I
am sorry for being off-topic.
--
Hsiang Huang
University of California at Berkeley
Department of Electrical Engineering/Computer Science
hasandiwan@mindless.b.com <--- anti-spam remove b. to reply
------------------------------
Date: Thu, 5 Mar 1998 11:50:38 +1100
From: "Tze Weng Foong" <tfoong@patrick.com.au>
Subject: PerlW32 on NT, cannot use > or | why?
Message-Id: <6dkski$50$1@merki.connect.com.au>
Hello All,
I am not able to get the data redirected to a file or piped to another
program!
even simple programs that say print "hello world\n"; dont work
eg if I run the program hello.pl at the command prompt
like so
C:> hello.pl
all is well and i see the following output
hello world
but if Do something like this
C:> hello.pl | more
Nothing happens, no output.
The following command results in an empty file called test.txt
C:> hello.pl > test.txt
This is getting very frustrating as I have to use options
to get filenames and open them and read and write them
which may be good but not really fun if all i need is something
simple like to convert tabs to spaces.
I have had a look at the windows95.txt that suggest a change
in the register for windows 95. I was desperate so I tried
that incantation on the NT Server which I am running on but
that did not work anyway.
I am using the latest version of Perl for Win32. Other than that
little niggle its great! Installed the internet extentions for FTP
and HTTP and that works great as well.
Please Help !
Thanks in advance.
Tze Weng Foong
------------------------------
Date: 5 Mar 1998 00:39:52 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: QUESTION ! how to fill out referer variable in LWP::USERAGENT
Message-Id: <6dks8o$sj3$4@client2.news.psi.net>
lufan@cheerful.com (lufan@cheerful.com) wrote on 1646 September 1993 in
<URL: news:34FD89FA.36AE@cheerful.com>:
++ hi there,
++
++ I wrote a spider in PERL 5.003 using LWP::UserAgent, to
++ fetch a page from WWW.
++
++ I want to make the HTTP server take my request as click from a
++ specific page, so I want to know whether LWP::useragent or HTTP has a
++ variable that can be filled out with an URL emulating just it comes
++ from, which used to be logged in httpd server's \logs\referer.log file
Did you read the manual pages? Including HTTP::Headers?
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: 5 Mar 1998 00:43:42 GMT
From: shaug@gromit.callamer.com (O'Shaughnessy Evans)
Subject: Re: QUIZ: answer and hash slice tutorial
Message-Id: <6dksfu$a98$1@ha1.rdc1.occa.home.com>
In article <x7u39fxabq.fsf@sysarch.com>, Uri Guttman's <uri@sysarch.com>
keyboard spewed forth thus:
> i wasn't aiming my quiz at newbies per se. i just found an interesting
> idiom and wanted to share it with whoever could use it. my tutorial is
> definitely NOT aimed at the "i just learned perl this week and i am
> writing a complex CGI system, please help me!" crowd. it is more for
> those who use perl and want to learn soemthing usefule and maybe
> interesting that they didn't already know.
Well, I appreciate it, Uri. I use Perl whenever the opportunity arises,
and if that doesn't work, I usually find reasons to use it anyhow.
There's so much to learn, though, that I didn't even really take note of
@hash{@array} assignments until a couple of months ago, and I've been
Perling for about 2 years now. As a recently-graduated CS student,
understanding Perl hasn't been completely out of my league, but your
tutorial was a real pleasure to read. I found the comments for newbies
useful, too, just to confirm that I understood the topic.
So, thanks. This is the kind of stuff I read the newsgroup for.
--
- O'Shaughnessy Evans
- http://www.callamerica.net/shaug/
------------------------------
Date: 5 Mar 1998 00:42:54 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: regexp
Message-Id: <6dksee$sj3$5@client2.news.psi.net>
bourhis@qcd.th.u-psud.fr (bourhis@qcd.th.u-psud.fr) wrote on 1646
September 1993 in <URL: news:6dkkt5$4bc$1@nnrp1.dejanews.com>:
++ I want to remove the sequence '\n', five spaces and one character which is not
++ whitespace in a string. I tried the regexp /\n {5}\S/ but it does not work.
++ Strangely (for me), the regexp / {5}\S/ and /\n {5}/ works.
It works for me:
$ perl -wle '$_ = "foo\n !bar"; s/\n {5}\S//; print'
foobar
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
------------------------------
Date: 5 Mar 1998 01:45:15 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: regexp
Message-Id: <6dl03b$79t@news-central.tiac.net>
In article <6dkkt5$4bc$1@nnrp1.dejanews.com>,
<bourhis@qcd.th.u-psud.fr> wrote:
>I want to remove the sequence '\n', five spaces and one character which is not
>whitespace in a string. I tried the regexp /\n {5}\S/ but it does not work.
>Strangely (for me), the regexp / {5}\S/ and /\n {5}/ works.
Could you post the code? In the debugger this works for me:
DB<1> $str = "THRaK\n xaTTaK"
DB<2> $str =~ s/\n {5}\S//
DB<3> X str
$str = 'THRaKaTTaK'
Remember that \S must match a character which isn't whitespace, it can't
match nothing.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: 5 Mar 1998 01:09:39 GMT
From: shaug@gromit.callamer.com (O'Shaughnessy Evans)
Subject: Re: Summing Up Array Values - How Do I?
Message-Id: <6dku0j$a98$2@ha1.rdc1.occa.home.com>
In article <6dibah$ci@Mars.mcs.net>, Jim Allenspach <jima@MCS.COM>'s
keyboard spewed forth thus:
>jima at mcs dot com
>Chicago, IL Perl programmers do it
>http://www.streams.com/jima/ with one hump.
In case nobody else noticed, I think this ^^^^^^^^^^^^^^^ bears repetition.
I don't know that I would take it as a compliment, but man... LOL!
--
- O'Shaughnessy Evans
- http://www.callamerica.net/shaug/
------------------------------
Date: Wed, 04 Mar 1998 19:41:51 -0500
From: mshavel@erols.com (Michael Shavel)
Subject: use @records[$index] or $records[$index] ??
Message-Id: <mshavel-0403981941510001@130.9.16.207>
Hi
I'm splitting up a text file into array entries, using a \n to tell me
when I am at the end of a record. I have used the code below and it seems
to work fine but when I use -w I get this message:
Scalar value @records[$index] better written as $records[$index] at newp.pl line
22.
#input file into array with each element being a record
while(<>)
{
#create array of records
@records[$index] = split /"\n"/;
$index++;
}
If I change the line to $records[$index] = split /"\n"/;
I get this as a message with -w :
Use of implicit split to @_ is deprecated at newp.pl line 22.
Also the code does not do what I want it to do when I change it like this.
Now I am wondering if the first error message I am getting is incorrect
and I have nothing to worry about or if I just went about creating this
array incorrectly.
Thanks for your help and advice.
Sincerely
Mike Shavel
mshavel@erols.com
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 2026
**************************************