[18558] in Perl-Users-Digest
Perl-Users Digest, Issue: 726 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 20 06:05:43 2001
Date: Fri, 20 Apr 2001 03:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <987761109-v10-i726@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 20 Apr 2001 Volume: 10 Number: 726
Today's topics:
...just a note of thanks <webmaster@webdragon.unmunge.net>
Re: Can File::Find selectively search subdirs? <Robert.H.Lowe@lawrence.edu>
Re: Curious Scalar-Interpolation <iltzu@sci.invalid>
Re: help for a basic hash value access question <webmaster@webdragon.unmunge.net>
Re: help for a basic hash value access question <joe+usenet@sunstarsys.com>
Re: hex to binary conversion <iltzu@sci.invalid>
Re: howto not echo a password while reading from stdin (Rafael Garcia-Suarez)
Re: howto not echo a password while reading from stdin (Brandon Metcalf)
Re: howto not echo a password while reading from stdin nobull@mail.com
Re: Laziness, Impatience and Hubris :-) <iltzu@sci.invalid>
Multi dimensional array dimensions <pontarolo@warpstudio.ch>
Re: Net::SMTP <webmaster@webdragon.unmunge.net>
Re: Owner problem nobull@mail.com
Re: Owner problem <bart.lateur@skynet.be>
Re: Premature end of script headers? <iltzu@sci.invalid>
Re: really strange error... please help (: <ultramafic1@yahoo.com>
regexp matching with optional part <ronald.fischer.gp@icn.siemens.de>
REgexp with variable <pontarolo@warpstudio.ch>
Re: Regular Expressions (again) <s.warhurst@rl.ac.uk>
Re: Regular Expressions (again) <s.warhurst@rl.ac.uk>
Re: Regular Expressions (again) <s.warhurst@rl.ac.uk>
Re: Suggestions for "OR" compares??? <iltzu@sci.invalid>
Re: two associative arrays printed at the same time nobull@mail.com
Re: unicode-impressions <bart.lateur@skynet.be>
Re: unicode-impressions <pilsl_@goldfisch.at>
Re: Using boundaries within regexps <iltzu@sci.invalid>
Re: weird problem, help? <xris@dont.send.spam>
Re: Why Perl? <bart.lateur@skynet.be>
Re: xoring bits <iltzu@sci.invalid>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 20 Apr 2001 07:15:23 GMT
From: "Scott R. Godin" <webmaster@webdragon.unmunge.net>
Subject: ...just a note of thanks
Message-Id: <9bonmb$b8t$1@216.155.32.202>
Despite having the Camel to draw on, and having picked up the MacPerl
book by Chris Nandor and Vicki Brown when I *first* got started playing
with Perl.. there's absoloutely NO way I would have gotten as far and as
fast as I have, without the assistance of the folks here at clpm.
I'm finding that I'm able to assimilate new concepts MUCH more easily
nowadays, and am just breezing through some of the stuff I used to think
was much more difficult. Of course, I'm still having a time of it
wrapping my brain around the OO perl (being unfamiliar with OO concepts
to begin with, since I have no java/c++ experience .. most of my
background came from Level 3 BASIC / Z-80 Assembler from my TRS-80 days
and then Tcl/Tk from when I was playing with eggdrop bots on efnet. :-),
but Damian Conway's book is a constant traveling companion with me
nowadays, as I read and re-read it waiting for epiphany. hehehe :)
My code is cleaner, easier to parse months later, easier to
mangle/update, and still it just scares me sometimes how much I have yet
to learn. :-)
I couldn't have done it without you folks, though, so credit where
credit is due. WITH any luck I'll have some programs I've created
running on some high-traffic sites in the next few months, and will have
that to show for my abilities, which will further enable me to sell my
services in the future; However, I know that I'll still be coming here
for a long time. There's always someone asking questions about things
with which I am unfamilar, being from a non-unix world as a Mac user,
and plenty of opportunities for me to continue learning. I honestly
haven't had this much fun since I learned Leo Christopherson's methods
of hacking z-80 assembler into BASIC code on the old Radio Shack 'puter.
:-)
I'd be very sorry to see some of you go, driven off by the intense
influx of people unfamiliar with usenet convention/basic
concepts/nettiquette, etc, although I understand your frustration,
having been an IRCop on several networks in the past. ("six hundred
million sperm and *you* were the fastest?" being a favorite quote of
mine back in those days.)
I hope I haven't annoyed too many people out-growing my newbieishness,
and preconceptions. I hope that I can continue to grow into a valuable
resource for the Perl community, but there's some raaaather large
footsteps for me to follow in. My thanks go out to you, who have beaten
the path so wide and led the way for the rest of us. :)
.....
ahhhhhhhhh, forget all that long-winded crap.
you folks r0ck. 'nuff said.
:-)
--
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw";
# ( damn spammers. *shakes fist* take a hint. =:P )
------------------------------
Date: Mon, 16 Apr 2001 13:25:17 -0500
From: Robert Lowe <Robert.H.Lowe@lawrence.edu>
Subject: Re: Can File::Find selectively search subdirs?
Message-Id: <3ADB390D.C3CC7A73@lawrence.edu>
Hi Randall!
You probably didn't see my post, since I forgot to copy you by e-mail.
I included it below. I tried a couple of approaches at a platform
independent model, none of which seemed very efficient. Find::File
seems to work a bit differently on Win32, working backwards, i.e.
lexigraphically, which just seemed odd. You also have to give
it a starting directory with a backslash, e.g. X:\, but thereafter
it returns dir names with forward slashes. The Win32::NetAdmin
module seems like it could be useful, but it only if you run it
on the domain controller. Since I'm after something in W2K, maybe
I could try using LDAP directly. Both of these approaches depart
drastically from something that works on UNIX though. I hate to give
up on a more closely matching solution, so if you have another idea,
I'll run with it. Either way, thanks for the suggestions... I won't
bother you further.
-Robert
"Randal L. Schwartz" wrote:
>
> >>>>> "Randal" == Randal L Schwartz <merlyn@stonehenge.com> writes:
>
> Randal> Well, "every user's home directory" with a ".netscape" directory is
> Randal> fetched from getpwent like so:
>
> Randal> my @dirs = grep -d "$_/.netscape", do {
> Randal> my %list;
> Randal> my @item;
> Randal> $list{$item[7]}++ while @item = getpwent;
> Randal> keys %list;
> Randal> };
>
> Randal> Then use @dirs as your starting points for a File::Find.
>
> Oops... not quite. That's all the homedirs that have a .netscape subdir.
> To make it useful for File::Find, you gotta do this instead:
>
> my @dirs = grep -d, do {
> my %list;
> my @item;
> $list{$item[7]}++ while @item = getpwent;
> map "$_/.netscape", keys %list;
> };
I hadn't thought of this -- and if I had, I'm sure my solution
would not have been as elegant! :)
While this makes good sense for UNIX, what if I also have a
similar problem on a Windows system, where home directories are
X:\group-name\username\ (I believe home directories might only
point to the group folder too)?? I'm not familiar enough with
Perl on Win32 systems to know if/how getpwent might even be
implemented there . If it, or something similiar, can be used
there, then I'm set in both cases. If not, then it seems like
a harder nut to crack, even if only in a platform-independent
manner. It sure seems like it would nice if File::Find could
be told to prune after N levels, rather than just 'yes' or
'no', doesn't it? Maybe I can accomplish this by setting
File::Find::prune=0 until the number of directory separators
(forward or backward slash) in File::Find::dir reaches the
magic number, and then set it to 1 unless I hit on the
desired directory? Or does that still seem like the wrong
approach?
TIA,
Robert
------------------------------
Date: 20 Apr 2001 08:52:52 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Curious Scalar-Interpolation
Message-Id: <987755964.21851@itz.pp.sci.fi>
In article <3adebcff$0$1819$4dbef881@businessnews.de.uu.net>, Andreas Muck wrote:
>
>I'm about writing a shopping-card-application and I got following problem
http://www.dictionary.com/cgi-bin/dict.pl?term=shopping+card
>sub show_card{
> my $q = shift;
[snip]
> $q->textfield( -name => "menge",
> -value => $menge_card,
> -size => "2",
> -maxlength => "2"
> ),
> $q->hidden( -name => "pzn",
> -value => $pzn_card
> ),
You're being bitten by CGI.pm's "stickiness". If $q already has a
parameter named "menge", the value of that parameter overrides any
default value given in the $q->textfield() method call. The same is
true for $q->hidden() and any other form-element generating methods.
This is intentional, and can be very useful in scripts that receive and
rebuild the same form over and over again -- which describes a lot of
CGI scripts. Yours, unfortunately, isn't one of those.
Passing the "-force => 1" parameter to the methods is one solution, but
not very elegant. I would instead create a clean, empty CGI object just
for this subroutine, since there is really no reason to use the same CGI
object that contains the query parameters.
To do that, replace the first line of the subroutine with:
my $q = CGI->new(""); # clean new CGI object ("" = no params)
Of course, that means you don't need to pass the original CGI object
when calling the subroutine anymore.
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla / Kira -- do not feed the troll.
------------------------------
Date: 20 Apr 2001 07:21:59 GMT
From: "Scott R. Godin" <webmaster@webdragon.unmunge.net>
Subject: Re: help for a basic hash value access question
Message-Id: <9boo2n$b8t$3@216.155.32.202>
In article <9bncnt$gnh$1@mamenchi.zrz.TU-Berlin.DE>,
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote:
| > to the list. Actually I'm not really sure you can take a reference to a
| > list, I think it would always be converted to an array reference.
|
| You get a list of references. The "\" operator distributes over
| a list. I have yet to find that useful...
That depends .. While I haven't used such in my own scripts yet, I can
definitely see the usefulness and clean-maintainable-code look of
passing multiple references to a sub via
my @result = my_sub( \(@ary1, @ary2, %hash) );
or various other permutations thereof.
--
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw";
# ( damn spammers. *shakes fist* take a hint. =:P )
------------------------------
Date: 20 Apr 2001 04:08:25 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: help for a basic hash value access question
Message-Id: <m34rvkvvra.fsf@mumonkan.sunstarsys.com>
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:
> According to Gwyn Judd <tjla@guvfybir.qlaqaf.bet>:
>
> > to the list. Actually I'm not really sure you can take a reference to a
> > list, I think it would always be converted to an array reference.
>
> You get a list of references. The "\" operator distributes over
> a list. I have yet to find that useful...
Actually it's pretty useful for binding columns within DBI:
use base "DBI::st";
sub bind_hash {
my ($self, $hash_ref) = @_;
$self->bind_columns( \ @{$hash_ref}{ @{$self->FETCH("NAME")} } );
}
...
$sth->execute;
my %results;
$sth->bind_hash(\%results);
print %results while $sth->fetch; # whatever
...
--
Joe Schaefer "I hate a country witout a derrick."
--Mark Twain
------------------------------
Date: 20 Apr 2001 08:13:20 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: hex to binary conversion
Message-Id: <987671223.22325@itz.pp.sci.fi>
In article <3ADDDA13.6070906@yahoo.com>, RayJ wrote:
>How can I turn 99(hex) into 10011001??
Yet another way to do it:
$bit_string = unpack "B*", pack "H*", $hex_string;
Replace the asterisks with the exact lengths in bits and hex digits if
you're not happy with the way perl DWIMs it.
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla / Kira -- do not feed the troll.
------------------------------
Date: 20 Apr 2001 07:08:16 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: howto not echo a password while reading from stdin
Message-Id: <slrn9dvo4b.qkv.rgarciasuarez@rafael.kazibao.net>
Chris Cera wrote in comp.lang.perl.misc:
} Could somebody please tell me how to do this. I want the user to
} be able to enter his/her command from a terminal. I want the
} input to be concealed. Is this possible?
This is a FAQ.
perldoc -q password
---> 'How do I ask the user for a password?'
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: 20 Apr 2001 07:11:03 GMT
From: bmetcalf@baynetworks.com (Brandon Metcalf)
Subject: Re: howto not echo a password while reading from stdin
Message-Id: <9bone7$oui$1@bcarh8ab.ca.nortel.com>
cera@drexel.edu writes:
> Could somebody please tell me how to do this. I want the user to
> be able to enter his/her command from a terminal. I want the
> input to be concealed. Is this possible?
man perlfaq8
How do I ask the user for a password?
Brandon
------------------------------
Date: 20 Apr 2001 08:40:58 +0100
From: nobull@mail.com
Subject: Re: howto not echo a password while reading from stdin
Message-Id: <u9g0f4dj37.fsf@wcl-l.bham.ac.uk>
cera@drexel.edu (Chris Cera) writes:
> Could somebody please tell me how to do this. I want the user to
> be able to enter his/her command from a terminal. I want the
> input to be concealed. Is this possible?
Could somebody please tell me how to do this. I want people to check
the FAQ before posting to Usenet. I want the fact that every
newcommer is likely to need to ask the same questions to be concealed.
Is this possible?
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 20 Apr 2001 08:13:06 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Laziness, Impatience and Hubris :-)
Message-Id: <987667861.18153@itz.pp.sci.fi>
In article <tdrkasch0u2s61@corp.supernews.com>, Chris Stith wrote:
>
>We need to develop a language that can fail in non-deterministic ways.
>Then, we can see if it chases newbies away or causes more posts saying
>`does not work'.
..but I thought we already had C.
http://www.tuxedo.org/~esr/jargon/html/entry/smash-the-stack.html
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla / Kira -- do not feed the troll.
------------------------------
Date: Fri, 20 Apr 2001 11:21:10 +0200
From: Gianpaolo Pontarolo <pontarolo@warpstudio.ch>
Subject: Multi dimensional array dimensions
Message-Id: <3ADFFF86.C97B652A@warpstudio.ch>
HI,
I have a such array and I would like to have the dimensions of this
array, how can I do this ?
The array:
#0 #1
#2 #3 #4 #5
@muxxer = ([ "000", "064", "128", "192", "256",
"320"], # -- 0
[ "001", "065", "129", "193",
"257", "321"], # -- 1
[ "002", "066", "130", "194",
"258", "322"]); # -- 2
With
$length_vertical=@muxxer;
I get the "vertical length" of the array (in this case 3), but to get
the orizontal length (in this case 6)? How can I get this ?
Thanks
GPo
------------------------------
Date: 20 Apr 2001 07:18:17 GMT
From: "Scott R. Godin" <webmaster@webdragon.unmunge.net>
Subject: Re: Net::SMTP
Message-Id: <9bonrp$b8t$2@216.155.32.202>
In article <3ADF5D25.87CAD571@quisic.com>,
Darnell Kelly <dkelly@quisic.com> wrote:
| that did it...thanks...i used data instead of datasend...are these both real
| methods or arbitrary because i know that data works but hadn't seen datasend
| before.
|
You might also consider the MailTools module on CPAN -- just a bit more
comprehensive, and also, unlike the current Net::SMTP, it sends RFC-822
compliant headers :-)
use CPAN.pm to search for Mail::Mailer or /MailTools/
--
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw";
# ( damn spammers. *shakes fist* take a hint. =:P )
------------------------------
Date: 20 Apr 2001 08:41:38 +0100
From: nobull@mail.com
Subject: Re: Owner problem
Message-Id: <u9wv8gdnm5.fsf@wcl-l.bham.ac.uk>
"Brian Lain" <brian@cs.wnmu.edu> writes:
> Hi, I'm writing CGI scripts to make user directories and write an index.html
> file in that directory. Everything works fine, but if I try to anything to
> that file with FTP, I get a "Not owner" error. How can I make my CGI script
> create the directory and file with the correct ownership?
This is more an OS thing than a Perl thing.
In Unix files are always created with the owner set to the current
effectuve user ID ( $> in Perl). You can only alter $> if your script
is running as superuser - not something you want to do in a CGI script.
You can produce scripts that run with a modified EUID, see perlsec for
details.
Your web server s/w may also provide a means to control the UID of scripts.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 20 Apr 2001 09:42:54 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Owner problem
Message-Id: <gn00et4f68ur9l56iepktuikmrgstc0d7s@4ax.com>
Brian Lain wrote:
>Hi, I'm writing CGI scripts to make user directories and write an index.html
>file in that directory. Everything works fine, but if I try to anything to
>that file with FTP, I get a "Not owner" error. How can I make my CGI script
>create the directory and file with the correct ownership?
Pretty rotten situation, isn't it? And most OSes don't even allow you to
chown a file unless you're the superuser.
If your scripts chmod's the directories and files so they are world
readable/writable/(executable for directories), at least you can
manually edit the directory structure.
The only other solution is to create directories and files with a setuid
script/program. Many OSes don't allow setUID scripts, either, so you
need a (small) compiled program. Once a file exists, the owner isn't
changed by reopening it from a script. This is, of course, a bit of a
security hole, as any script can use it to overwrite files that it
wasn't supposed to be allowed to touch.
Bugger.
Search the web for "CGIwrap".
--
Bart.
------------------------------
Date: 20 Apr 2001 08:12:51 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Premature end of script headers?
Message-Id: <987597390.17318@itz.pp.sci.fi>
In article <urael-843488.03564418042001@news.metropolis.net.au>, Henry wrote:
>In article <987523817.21331@itz.pp.sci.fi>, Ilmari Karonen
><usenet11429@itz.pp.sci.fi> wrote:
>
>> Besides, your
>> code wouldn't work in the original poster's script, since you haven't
>> declared $query with "my" or "use vars".
>
>Hmmm, yes, well. 'perldoc CGI' never makes mention of that. And when
>the examples in the docs generate compile-time-errors, use strict; is
>the first thing to get shut off in favour of progress.
Unfortunately there is indeed a whole bunch of example code floating
around that will not work under "use strict" without modification.
Usually the only modification required is to declare variables with "my"
when they're initialized, and sometimes to quote barewords.
This newsgroup has slightly higher standards in that respect. We don't
generally want people posting code that doesn't pass strict checks, as
experience has shown that most people will not just "fill in the missing
details" in this respect.
>> I would also generally suggest putting "use CGI::Carp" before any of the
>> other "use" statements, since any errors before it won't get sent to the
>> browser.
>
>Out of curiosity, would the following be a 'acceptable' approach?
>
>BEGIN {
> use CGI::Carp qw(carpout fatalsToBrowser);
> carpout(STDOUT);
>}
>use CGI qw(:standard);
Yes, except that you don't really want to carpout(STDOUT). That will
send any warnings straight to the browser, which will probably treat
them as HTML syntax errors. Use warningsToBrowser() instead.
What I do is generally something like:
#!/usr/bin/perl -wT
use strict;
use CGI::Carp qw( fatalsToBrowser warningsToBrowser carpout );
BEGIN {
open CGI_LOG, '>>/home/i/l/iltzu/cgi.log'
or die "Error opening log file: $!\n";
carpout(\*CGI_LOG);
}
use CGI qw( :cgi );
print header();
warningsToBrowser();
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla / Kira -- do not feed the troll.
------------------------------
Date: Thu, 19 Apr 2001 23:51:00 -0800
From: Steve Wilbur <ultramafic1@yahoo.com>
Subject: Re: really strange error... please help (:
Message-Id: <190420012351006473%ultramafic1@yahoo.com>
In article <G3QD6.192953$GV2.42914357@typhoon.san.rr.com>, Nathan Wiger
<nate-news@wiger.org> wrote:
Check LD_LIBRARY_PATH (/net => Solaris, right?). Where was libexpat
compiled
> to live?
i compiled libexpat to live /net/klang/usr/lib as near as i can tell -
that's where it seems to be. (yeah, solaris by the way).
> This looks like what happens if libexpat is not in /usr/lib and you compile
> XML::Parser against it w/o -R/lib/path (it's a standard ld linker error).
> I'd reinstall XML::Parser, but if that's not an option, try setting
> LD_LIBRARY_PATH in your script:
>
> $ENV{LD_LIBRARY_PATH} = '/net/klang/usr/local/lib'; # guess
>
> But that's nasty, technically, since you'd have to do this for all your
> scripts.
well, before i got your message, i had been playing with
LD_LIBRARY_PATH with no luck. i'll try recompiling XML:Parser. lets
see if that works...well, no luck.
i tried both, same error. this is what i did to reinstall XML::Parser:
perl Makefile.PL EXPATLIBPATH=/net/klang/usr/local/lib
EXPATINCPATH=/net/klang/usr/local/include
and then make of course. whatever im doing, its still not working.
i'd appreciate any help you can give (:
the keys:
a).it seems to be installed fine as long as im not running as "nobody"
b).doesnt work even after putting
$ENV{LD_LIBRARY_PATH} = '/net/klang/usr/local/lib';
and similiar paths in my program....
thanks (:
------------------------------
Date: 20 Apr 2001 11:08:23 +0200
From: Ronald Fischer <ronald.fischer.gp@icn.siemens.de>
Subject: regexp matching with optional part
Message-Id: <7qfwv8gq6pk.fsf@icn.siemens.de>
I'm trying to write a regexp matching which should cut off an optional leading
"x-" or trailing "-x". the following cases:
In any case, the extracted part (after cutting off the leader or trailer)
should consist of at least one character; otherwise, the regexp should
fail. Example:
x-abc-x -> return abc
x-foo -> return foo
bar-x -> return bar
baz -> return baz
x--x -> fail
Can this be done easily in a single regexp? The closest I came was
/^(x-)?(.+?)(-x)$/
but this does not work (understandably) for the last case, "x--x". Of course I
could check the borderline case separately, but I wonder if there is a simple
way to do it.
Ronald
--
Ronald Otto Valentin Fischer < rovf @ earthling . net >
http://profiles.yahoo.com/ronny_fischer/
http://fusshuhn.ourfamily.com/cppincomp.html
This is Unix land. In quiet nights you can hear Windows machines reboot.
------------------------------
Date: Fri, 20 Apr 2001 11:23:53 +0200
From: Gianpaolo Pontarolo <pontarolo@warpstudio.ch>
Subject: REgexp with variable
Message-Id: <3AE00029.52D15963@warpstudio.ch>
Hi,
I have a regexp with inside a variable is it possible to have this and
how ?
Here the code :
while (.....) {
s /Hi $nome / Good Morning $nome / ;
....
}
the variable $nome changes during the loop .....
how can i put a variable in a such regexp ????
Thanks
GPo
------------------------------
Date: Fri, 20 Apr 2001 08:19:16 +0100
From: "S Warhurst" <s.warhurst@rl.ac.uk>
Subject: Re: Regular Expressions (again)
Message-Id: <9bonue$1doc@newton.cc.rl.ac.uk>
Yes, it is a LISTSERV list.. several thousand of them for that matter & I
want to extract all the email addresses out of all the headers. You're right
about the 100 character fixed length thingy.. I tihnk I have an answer on
how to extract them using regexp, so thanks anyway :)
Spencer
**********************************
"Christopher Pound" <pound@is.rice.edu> wrote in message
news:9bmuc8$nkt$1@joe.rice.edu...
> Is this a LISTSERV list? I believe the fullname field could theoretically
> contain an @ sign or email address (most often as a result of subscriber
> error, but it could be intentional). IIRC, listserv subscriptions are
really
> undelimited fixed-length (100 character?) records in which the first field
> always contains the email address and the last field always contains
> subscription details, everything in between being the fullname field.
> So, a general solution would take that into account.
>
> --
> Christopher Pound (pound@rice.edu)
> Dept. of Anthropology, Rice University
------------------------------
Date: Fri, 20 Apr 2001 08:43:57 +0100
From: "S Warhurst" <s.warhurst@rl.ac.uk>
Subject: Re: Regular Expressions (again)
Message-Id: <9bopco$13m6@newton.cc.rl.ac.uk>
Thanks.. that should do nicely.
The files are actually made up of 100-character undelimited "lines", hence
why I was treating it as a string.
Regards
Spencer
*****************************
"Michael Carman" <mjcarman@home.com> wrote in message
news:3ADEE202.4ACD979E@home.com...
> #!/usr/local/bin/perl5 -w
> use strict;
>
> while (<DATA>) {
> (my $email) = (/(\S+@\S+)/);
> print $email, "\n";
> }
------------------------------
Date: Fri, 20 Apr 2001 08:48:57 +0100
From: "S Warhurst" <s.warhurst@rl.ac.uk>
Subject: Re: Regular Expressions (again)
Message-Id: <9bopm3$sbm@newton.cc.rl.ac.uk>
Nobull -> thanks for your reply.. I'm going to try that in a minute...
For some reason my news server at work here doesn't show your reply but the
one I use dial-up at home did (darn crappy news services!)
Thanks
Spencer
***************************
"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrn9dto6i.2pd.tadmc@tadmc26.august.net...
> nobull@mail.com <nobull@mail.com> wrote:
>
> >my @addresses = $string =~ /(\S+\@\S+)/sg;
> ^
> ^ a distracting NO-OP
>
>
> --
> Tad McClellan SGML consulting
> tadmc@augustmail.com Perl programming
> Fort Worth, Texas
------------------------------
Date: 20 Apr 2001 09:20:41 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Suggestions for "OR" compares???
Message-Id: <987757198.25018@itz.pp.sci.fi>
In article <pb6udt0f0621q80f4gc3upi3ckteiu8ock@4ax.com>, Bart Lateur wrote:
>
> if(grep { $field eq $_ } 'A', 'B', 'C') {
> ...
> }
>
>and don't start those nonsense of grep() doing too much work, again.
>Yes, grep() does indeed count the number of matches. If it's not there,
>this makes no difference.
In fact, there are cases where the extra work can be useful. Consider:
while (1) {
my $cmd = prompt("Enter command: ");
my @cmd = sort grep /^\Q$cmd/, keys %dispatch;
$dispatch{$cmd[0]}->(), next if @cmd == 1;
print("Unknown command '$cmd'!\n"), next unless @cmd;
print("Ambiguous command, did you mean ",
join(", ", @cmd[0 .. @cmd-2]), " or $cmd[-1]?\n");
}
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla / Kira -- do not feed the troll.
------------------------------
Date: 20 Apr 2001 08:57:41 +0100
From: nobull@mail.com
Subject: Re: two associative arrays printed at the same time
Message-Id: <u9pue8dm67.fsf@wcl-l.bham.ac.uk>
"Just in" <justin.devanandan.allegakoen@intel.com> writes:
> Say if I had two associative arrays with the same keys (but different
> values).
> ... but is there a correct structure?
We don't know enough about your problem to be sure, but at a guess the
"correct" structure is probably a single hash each element of which is
a reference to a two element array.
You have:
%hash1 = ( foo => 1, bar =>2 );
%hash2 = ( foo => 3, bar =>4 );
Probably more efficient to make that:
%hash = ( foo => [1,3], bar =>[2,4] );
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 20 Apr 2001 09:07:27 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: unicode-impressions
Message-Id: <0buvdtk62806lpkqkc543a8svm65f677i8@4ax.com>
peter pilsl wrote:
>http://www.goldfisch.at/knowledge/unicode.html
>
>Comments are welcome (and of course I've very little time ;)
I noticed that your text under "What is unicode ?" is pretty incomplete,
and viewed on it's own, incorrect. Unicode is not a synonym for UTF-8!
You only point to <http://www.unicode.org> for more info, which is
rather, er, intransparent (as most official info sites, like
<www.xml.org>, usually are, if I'm allowed to vent).
A link to my favourite website on the subject might be handy:
<http://www.czyborra.com>. In fact, these pages pretty much contain most
you'll ever need to know, except of course that the info isn't
web/browser oriented.
--
Bart.
------------------------------
Date: Fri, 20 Apr 2001 11:52:40 +0200
From: peter pilsl <pilsl_@goldfisch.at>
Subject: Re: unicode-impressions
Message-Id: <MPG.154a2552beb16c1989828@news.inode.at>
In article <0buvdtk62806lpkqkc543a8svm65f677i8@4ax.com>,
bart.lateur@skynet.be says...
>
> A link to my favourite website on the subject might be handy:
> <http://www.czyborra.com>. In fact, these pages pretty much contain most
> you'll ever need to know, except of course that the info isn't
> web/browser oriented.
>
yep - very useful page. I included it on mine with high-recommendation-
level. I wish I would have found your page when starting to deal with this
topic. It answers a lot of questions.
thnx,
peter
--
pilsl@
goldfisch.at
------------------------------
Date: 20 Apr 2001 08:11:15 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Using boundaries within regexps
Message-Id: <987753949.19667@itz.pp.sci.fi>
In article <tdsb3shfvdij66@corp.supernews.com>, Craig Berry wrote:
>George Adams (g_adams27@hotSPAMISBADmail.com) wrote:
>: Thanks to those who replied to my earlier question - using m/// in a list
>: context works well.
>
> s/\/\/\//\/\/
s/\/\\\/\\\/\\\/\/\\\/\\\//\/\\\/\\\/\\\/\/\\\/\\\/\//
>Sorry, I couldn't resist. :)
Neither could I.
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla / Kira -- do not feed the troll.
------------------------------
Date: Fri, 20 Apr 2001 03:13:38 -0500
From: xris <xris@dont.send.spam>
Subject: Re: weird problem, help?
Message-Id: <xris-3E6933.03133820042001@news.evergo.net>
In article <slrn9dvmc8.k8o.rgarciasuarez@rafael.kazibao.net>,
rgarciasuarez@free.fr (Rafael Garcia-Suarez) wrote:
> Yes, that's weird. Perhaps there's a problem in SplitParams. perlfunc
> says about split() :
nah, SplitParams is a routine I designed to break apart comma-separated
function parameters (in this case, passed in via a keyword in an html
file). but there's definitely an issue in getting that "shift" to
properly send its data to SplitParams.
------------------------------
Date: Fri, 20 Apr 2001 09:31:31 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Why Perl?
Message-Id: <7h00eto7fs1srfbm2h3umdb9h0pvut9knu@4ax.com>
Tad McClellan wrote:
>I run 'htmltidy' on it.
>
> http://www.w3.org/People/Raggett/tidy/
Is it still as buggy? It sure was 3 months ago.
--
Bart.
------------------------------
Date: 20 Apr 2001 09:27:01 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: xoring bits
Message-Id: <987758564.26713@itz.pp.sci.fi>
In article <ciDD6.21775$BU4.35704@news1.blktn1.nsw.optushome.com.au>, Tom wrote:
>
>I'm trying to ^ 8bits 10000001 and 10001101, I'd like to have 8bits returned
>as the result but instead I get 420 when I ^ the two is there someway of
>returning the 8bits xor-ed ?
my $foo = pack 'b*', '10000001';
my $bar = pack 'b*', '10001101';
print unpack 'b*', $foo ^ $bar;
TIMTOWTDI, of course. You could use integers instead of bit strings,
and there are several ways to manipulate bit strings too.
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla / Kira -- do not feed the troll.
------------------------------
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 726
**************************************