[25050] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7300 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 25 09:06:00 2004

Date: Mon, 25 Oct 2004 06:05:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 25 Oct 2004     Volume: 10 Number: 7300

Today's topics:
    Re: arrays of arrays question <bernard.el-haginDODGE_THIS@lido-tech.net>
        FAQ 4.23: How do I find matching/nesting anything? <comdog@panix.com>
    Re: FAQ 4.56: What happens if I add or remove keys from <comdog@panix.com>
    Re: Fast random string generation <bart.lateur@pandora.be>
    Re: Fast random string generation <bart.lateur@pandora.be>
    Re: foreach vs. for <calle@lysator.liu.se>
    Re: foreach vs. for <Joe.Smith@inwap.com>
    Re: foreach vs. for <jurgenex@hotmail.com>
    Re: foreach vs. for <do-not-use@invalid.net>
        Hash slice as hash (David)
    Re: Hash slice as hash (Anno Siegel)
        Hash slices <gyruss@hushmail.com>
    Re: how do I call a function from a .so file in UNIX vi <abigail@abigail.nl>
    Re: how do I call a function from a .so file in UNIX vi <kalinaubears@iinet.net.au>
    Re: how do I call a function from a .so file in UNIX vi <koos@no.spam>
    Re: How to redefine warnings on recursion level <Joe.Smith@inwap.com>
        how to sort a hash of arrays? <g-preston1@ti.com>
    Re: how to sort a hash of arrays? <jurgenex@hotmail.com>
    Re: how to sort a hash of arrays? (Anno Siegel)
    Re: list vs array <do-not-use@invalid.net>
    Re: list vs array <bik.mido@tiscalinet.it>
    Re: MAIL recommendation <nospam@nospam.com>
    Re: MAIL recommendation <noreply@gunnar.cc>
        Parsing SGML with Perl (Mohd)
    Re: Parsing SGML with Perl <jurgenex@hotmail.com>
    Re: Practical Extraction Recording Language (Richard Williams)
    Re: Practical Extraction Recording Language <wyzelli@yahoo.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 25 Oct 2004 14:26:15 +0200
From: "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net>
Subject: Re: arrays of arrays question
Message-Id: <Xns958D92DDD63D4elhber1lidotechnet@62.89.127.66>

"daniel kaplan" <nospam@nospam.com> wrote:

> my other one, not sure if it's realted is i won't remember your 
> name for two months.  i'll remember everythign  you do, where from, 
> but names, like spelling just fly out of my head

[...]


Then how will you remember to ignore Tad's posts? And a follow-up
question - do you ever ignore your *own* posts by mistake?


-- 
Cheers,
Bernard


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

Date: Mon, 25 Oct 2004 10:03:02 +0000 (UTC)
From: PerlFAQ Server <comdog@panix.com>
Subject: FAQ 4.23: How do I find matching/nesting anything?
Message-Id: <clij0m$ffj$1@reader1.panix.com>

This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with Perl.

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

4.23: How do I find matching/nesting anything?

    This isn't something that can be done in one regular expression, no
    matter how complicated. To find something between two single characters,
    a pattern like "/x([^x]*)x/" will get the intervening bits in $1. For
    multiple ones, then something more like "/alpha(.*?)omega/" would be
    needed. But none of these deals with nested patterns. For balanced
    expressions using "(", "{", "[" or "<" as delimiters, use the CPAN
    module Regexp::Common, or see "(??{ code })" in perlre. For other cases,
    you'll have to write a parser.

    If you are serious about writing a parser, there are a number of modules
    or oddities that will make your life a lot easier. There are the CPAN
    modules Parse::RecDescent, Parse::Yapp, and Text::Balanced; and the
    byacc program. Starting from perl 5.8 the Text::Balanced is part of the
    standard distribution.

    One simple destructive, inside-out approach that you might try is to
    pull out the smallest nesting parts one at a time:

        while (s/BEGIN((?:(?!BEGIN)(?!END).)*)END//gs) {
            # do something with $1
        }

    A more complicated and sneaky approach is to make Perl's regular
    expression engine do it for you. This is courtesy Dean Inada, and rather
    has the nature of an Obfuscated Perl Contest entry, but it really does
    work:

        # $_ contains the string to parse
        # BEGIN and END are the opening and closing markers for the
        # nested text.

        @( = ('(','');
        @) = (')','');
        ($re=$_)=~s/((BEGIN)|(END)|.)/$)[!$3]\Q$1\E$([!$2]/gs;
        @$ = (eval{/$re/},$@!~/unmatched/i);
        print join("\n",@$[0..$#$]) if( $$[-1] );



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

Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short.  They represent an important
part of the Usenet tradition.  They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.

If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile.  If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.

Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release.  It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.

The perlfaq manual page contains the following copyright notice.

  AUTHOR AND COPYRIGHT

    Copyright (c) 1997-2002 Tom Christiansen and Nathan
    Torkington, and other contributors as noted. All rights 
    reserved.

This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.


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

Date: Mon, 25 Oct 2004 05:10:54 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: FAQ 4.56: What happens if I add or remove keys from a hash while iterating over it?
Message-Id: <251020040510540908%comdog@panix.com>

In article <hdojjpin.fsf@online.no>, Peter J. Acklam
<pjacklam@online.no> wrote:

> PerlFAQ Server <comdog@panix.com> wrote:

> > 4.56: What happens if I add or remove keys from a hash while iterating over
> > it?

> >     [lwall] In Perl 4, you were not allowed to modify a hash at all while
> >     iterating over it. In Perl 5 you can delete from it, but you still can't

> According to the docs for delete() it is safe to delete the
> key/value pair most recently returned from each().

that's what the answer says, too. :)

-- 
brian d foy, comdog@panix.com


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

Date: Mon, 25 Oct 2004 07:42:52 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Fast random string generation
Message-Id: <eibpn05ptj8qcogrg85kc5v9tvq5s3vul3@4ax.com>

Ala Qumsieh wrote:

>I didn't benchmark, but I would guess it's faster to call chr() 256 
>times instead of 20000 times:
>
>    # untested code
>    my @list = map chr, 0 .. 256;
>    my $str  = '';
>    $str    .= $list[rand @list] for 1 .. 20_000;

It's also not very random. I don't think it's the idea to have a repeat
period of 256 cycles.

-- 
	Bart.


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

Date: Mon, 25 Oct 2004 07:51:41 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Fast random string generation
Message-Id: <5kbpn09o692m2hoasj3f3a5nmu1sg1a7ph@4ax.com>

Derek Fountain wrote:

>I need to generate a string of random characters, say about 20,000
>characters long. And I need to do it quickly! I tried the obvious:
>
>    for( my $i=0; $i<20000; $i++ ) {
>      $str .= chr(int(rand(256)));
>    }
>
>which works, but I have a feeling there must be a faster way than doing
>20,000 string concatenations...?

I have the following basic 3 ideas:

  1) prebuild a string of 20000 bytes, and use substr to replace the
concatenation:

	$x = " " x 20000;
	substr($x, $_, 1) = chr rand 256 for 0 .. 19999;


  2) ditto, but use vec() (bypasses chr()):

	$x = " " x 20000;
	vec($x, $_, 8) = rand 256 for 0 .. 19999;


  3) use pack 'C*' to replace all of the chr() calls + concat/join:

	$x = pack 'C*', map int rand 256, 1 .. 20000;

-- 
	Bart.


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

Date: Mon, 25 Oct 2004 10:20:04 +0200
From: Calle Dybedahl <calle@lysator.liu.se>
Subject: Re: foreach vs. for
Message-Id: <86hdojky4r.fsf@ulthar.bisexualmenace.org>

>>>>> "Austin" == Austin P So <(Hae Jin)" <who@what.where>> writes:

> Sisyphus wrote:
>> I mean 'for' and 'foreach' are simply synonymous, irrespective of
>> which of the "two distinct meanings" you're referring to.

> Hmmm...if I'm not mistaken, the real difference is in how they use memory.

There is no difference between them. They will both generate exactly
the same bytecode, which you can check yourself with B::Concise.

-- 
                    Calle Dybedahl <calle@lysator.liu.se>
		 http://www.livejournal.com/users/cdybedahl/
	 "I'd rather hang on to madness than normality" -- KaTe Bush


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

Date: Mon, 25 Oct 2004 09:22:35 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: foreach vs. for
Message-Id: <vB3fd.3505$R05.548@attbi_s53>

Austin P. So (Hae Jin) wrote:

> Sisyphus wrote:
> 
>> I mean 'for' and 'foreach' are simply synonymous, irrespective of 
>> which of the "two distinct meanings" you're referring to.
>  
> Hmmm...if I'm not mistaken, the real difference is in how they use memory.

No, not 'how', it's 'how much'.  One takes three bytes of source code, the
other takes seven.  But once the statement is compiled, there is _NO_
difference between 'for' and 'foreach'.

	-Joe


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

Date: Mon, 25 Oct 2004 10:13:22 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: foreach vs. for
Message-Id: <6l4fd.1138$dW.976@trnddc08>

Austin P. So (Hae Jin) wrote:
> Sisyphus wrote:
>> I mean 'for' and 'foreach' are simply synonymous, irrespective of
>> which of the "two distinct meanings" you're referring to.
>
> Hmmm...if I'm not mistaken, the real difference is in how they use
> memory.

That's right.
"foreach" needs  four bytes more in your source code.

jue 




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

Date: 25 Oct 2004 12:58:30 +0200
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: foreach vs. for
Message-Id: <yzdzn2b3vzd.fsf@invalid.net>


Ben Morrow <usenet@morrow.me.uk> writes:
> Quoth Sherm Pendley <spamtrap@dot-app.org>:
> > daniel kaplan wrote:
> > 
> > > am trying to find out if there is an essential difference between the way
> > > the two run that you would chose one over the other.  the best answer i have
> > > found so far (book) was "foreach is longer to type".
> > 

> All of this is explained perfectly well in the std docs, of course (and
> if it isn't, we want to know so we can fix them).

I agree that it's explained unambiguously in the docs, but I for one
was confused for a short while (when finding out the meaning of a code
example posted here) when first seeing the short (different) synopsis
(synopses?) under compound statements, then the section about "for",
then the section about "foreach", and only after that, in the third
paragraph under "foreach", the statement that they are equivalent. I
think that is the first thing that should be said about both of them.


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

Date: 25 Oct 2004 00:22:54 -0700
From: davidol@hushmail.com (David)
Subject: Hash slice as hash
Message-Id: <3bef037b.0410242322.486ccef0@posting.google.com>

Dear all,

I'd like extract particular values from a hash, as a hash. I've done
it in the code below using a foreach loop

Is there a cleaner way?

Thanks.
 
sub get_db_properties
{
  my $rec = shift;
  my @db_properties = qw ( db_user db_pass db_server );
  my $ret;

  foreach my $prop ( @db_properties)
  {
    $ret->{$prop} = $rec->{$prop};
  }

  return $ret;
}


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

Date: 25 Oct 2004 10:11:21 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Hash slice as hash
Message-Id: <clijg9$4st$1@mamenchi.zrz.TU-Berlin.DE>

David <davidol@hushmail.com> wrote in comp.lang.perl.misc:
> Dear all,
> 
> I'd like extract particular values from a hash, as a hash. I've done
> it in the code below using a foreach loop
> 
> Is there a cleaner way?
> 
> Thanks.
>  
> sub get_db_properties
> {
>   my $rec = shift;
>   my @db_properties = qw ( db_user db_pass db_server );
>   my $ret;
> 
>   foreach my $prop ( @db_properties)
>   {
>     $ret->{$prop} = $rec->{$prop};
>   }
> 
>   return $ret;
> }

There are alternatives, though I don't think of them as definitely
"cleaner".

The "foreach" loop could be a statement modifier:

    $ret{ $_} = $rec->{ $_} for @db_properties;

or it could be replaced by a map().  In full:

    sub get_db_properties {
        my $prop = shift;
        +{ map { $_ => $prop->{ $_} } qw( db_user db_pass db_server)};
    }

Anno


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

Date: Mon, 25 Oct 2004 20:36:34 +1000
From: "Gyruss" <gyruss@hushmail.com>
Subject: Hash slices
Message-Id: <417cd73f_1@news.iprimus.com.au>

http://tlc.perlarchive.com/articles/perl/ug0001.shtml




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

Date: 25 Oct 2004 07:43:50 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: how do I call a function from a .so file in UNIX via a perl script?
Message-Id: <slrncnpblm.3ac.abigail@alexandra.abigail.nl>

news.hinet.net (sonet@msa.hinet.net) wrote on MMMMLXXIII September
MCMXCIII in <URL:news:clhuq6$p1t$1@netnews.hinet.net>:
`'  Can perl script create shared object (.so) libraries in a UNIX environment??
`'  and

Yes, although it might be a lot easier to use a compiler for that.

`'  how do I call a function from a .so file in UNIX via a perl script?

Use XS or Inline::C.



Abigail
-- 
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'


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

Date: Mon, 25 Oct 2004 18:11:19 +1000
From: Sisyphus <kalinaubears@iinet.net.au>
Subject: Re: how do I call a function from a .so file in UNIX via a perl script?
Message-Id: <417cb66f$0$13760$5a62ac22@per-qv1-newsreader-01.iinet.net.au>

Abigail wrote:

> 
> `'  how do I call a function from a .so file in UNIX via a perl script?
> 
> Use XS or Inline::C.
> 


There's also C::DynaLib which (I'm told) can be used to directly access 
the functions in shared libs on most *nix systems. I haven't tried it, 
and I know nothing about it. Search comp.lang.perl.misc for the thread 
entitled "new Perl feature request: call into shared libs" (from March 
2003).

For myself ... I'll just stick with XS and inline::C :-)

Cheers,
Rob

-- 
To reply by email u have to take out the u in kalinaubears.



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

Date: Mon, 25 Oct 2004 11:12:55 +0200
From: Koos Pol <koos@no.spam>
Subject: Re: how do I call a function from a .so file in UNIX via a perl script?
Message-Id: <newscache$kuu46i$os7$1@news.emea.compuware.com>

Abigail wrote (Monday 25 October 2004 09:43):

> ...http://work.ucsd.edu:5141...

DNS Domain 'work.ucsd.edu' is invalid: Host not found.

-- 
KP
43rd Law of Computing: "Anything that can go wr
fortune: Segmentation violation -- Core dumped


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

Date: Mon, 25 Oct 2004 09:09:17 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: How to redefine warnings on recursion level
Message-Id: <1p3fd.244234$wV.115112@attbi_s54>

Gerhard M wrote:

> This also could be done with an iterative algorithm. The recursion was
> my first idea and it works (except the warning). It's easy to
> understand so why to change it?

Efficiency.  Have you checked how much slower recursion is in this case?
	-Joe


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

Date: Mon, 25 Oct 2004 05:22:15 -0500
From: "Jerry Preston" <g-preston1@ti.com>
Subject: how to sort a hash of arrays?
Message-Id: <clik4n$7o3$1@home.itg.ti.com>

I know the following works:

    if( @{ $dat{ $ST }} ) {
      @dat_ = @{ $dat{ $ST }};
       foreach $j ( @dat ) {
         ....
       }
    }
I am trying to figure out how to do in the following format of which do not
work:

  foreach $j ( sort { @{ $wafers{ $ST }{ $a } } cmp @{ $wafers{ $ST }{
$b } } } @{ $wafers{ $ST }} ) {
or
  foreach $j ( sort { @{ $wafers{ $a } } cmp @{ $wafers{ $b } } } keys
%wafers ) {
or
    if( @{ $dat{ $ST }} ) {
      $j= [ sort { $a cmp $b } @{ $j } ];

Any ideas?

Thanks,

Jerry





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

Date: Mon, 25 Oct 2004 11:03:31 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: how to sort a hash of arrays?
Message-Id: <745fd.2800$jD4.1498@trnddc06>

Jerry Preston wrote:
> I know the following works:

By some private definition of "works" which you didn't share with us.

[code snipped]
> I am trying to figure out how to do in the following format of which
> do not work:

By some private definition of "do not work" which you didn't share with us.

[code snipped]
> Any ideas?

Yes. Please let us know what you expect the code to do ("it works") versus 
what you are actually observing ("does not work"). We are not mind readers, 
therefore we cannot know what your were thinking when you wrote "works" 
(although some people are close).

As for "works" in combinatino with your subject line: this is akin to a 
perpetuum mobile. A hash by definition does not have a (useful) order, 
therefore you cannot sort it. You can probably sort the keys or sort the 
values, but there is no way to sort the hash itself.

There is the  Tie::IxHash module, which emulates order on hashes. Please see 
Google about earlier postings on this subject.

Oh, and before I forget: this _Q_uestion is _A_sked _F_requenty. Please 
check the FAQ (perldoc -q hash) beforehand next time:
    How do I sort a hash (optionally by value instead of key)?
    How can I always keep my hash sorted?


jue 




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

Date: 25 Oct 2004 10:59:30 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: how to sort a hash of arrays?
Message-Id: <climai$4st$2@mamenchi.zrz.TU-Berlin.DE>

Jerry Preston <g-preston1@ti.com> wrote in comp.lang.perl.misc:
> I know the following works:
> 
>     if( @{ $dat{ $ST }} ) {
>       @dat_ = @{ $dat{ $ST }};
>        foreach $j ( @dat ) {
>          ....
>        }
>     }

Works?  Whatever you mean with that, you are using "dat" once as a
hash and once as an array.  Your array is "@dat_", so no, it won't
even compile.

> I am trying to figure out how to do in the following format of which do not
> work:

"Does not work" is no valid error description, especially since
you have never said what "work" would mean.

>   foreach $j ( sort { @{ $wafers{ $ST }{ $a } } cmp @{ $wafers{ $ST }{
> $b } } } @{ $wafers{ $ST }} ) {
> or
>   foreach $j ( sort { @{ $wafers{ $a } } cmp @{ $wafers{ $b } } } keys
> %wafers ) {
> or
>     if( @{ $dat{ $ST }} ) {
>       $j= [ sort { $a cmp $b } @{ $j } ];
> 
> Any ideas?

No.  Say what you want to achieve and we may have suggestions.

Throwing bits of code around without saying what they are supposed
to do is just as bad as a verbal problem description without any code.

Anno


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

Date: 25 Oct 2004 11:29:30 +0200
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: list vs array
Message-Id: <yzd4qkj5eo5.fsf@invalid.net>


"A. Sinan Unur" <1usa@llenroc.ude.invalid> writes:
> "daniel kaplan" <nospam@nospam.com> wrote in news:1098463265.457208
> @nntp.acecape.com:
> 
> > could someone please tell the difference between a "list" and an
> > "array"...or is it simply the way you reference direct data vs. assigned
> > data (to a variable) ?
> 
> This is a FAQ. Indeed, if you type 
> 
> perldoc -q "What is the difference between a list and an array?"
> 
> on the command line, or look at perlfaq4 in the documentation installed on 
> your computer, you will find the answer.

Another newbie here.

The perldoc says (among other things):

"and you foreach() across a list."

Would it be reasonable to also say that you foreach() across an array,
since what you do to $_ while looping affects the argument to foreach?


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

Date: Mon, 25 Oct 2004 13:39:01 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: list vs array
Message-Id: <l8ppn0puukvk5kgq0urgghhpeiu9n0vd0f@4ax.com>

On Fri, 22 Oct 2004 16:43:01 -0400, "daniel kaplan"
<nospam@nospam.com> wrote:

>> On the other hand, since I am not one asking for handouts here, I can
>> certainly afford not to read your posts.
>
>then just stop...oh, sorry, i meant exit

Huh?!?


It seems that I just can't grasp the sense of this man's words...
apart that their tone is arrogant and irrespectful...


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: Mon, 25 Oct 2004 03:57:38 -0400
From: "daniel kaplan" <nospam@nospam.com>
Subject: Re: MAIL recommendation
Message-Id: <1098691110.352418@nntp.acecape.com>

> Have you *still* not read the Posting Guidelines?

charlton,

rather than jump on the bandwagon, re-read my post, but here it is
again...read what i am asking.  i did not ask HOW DO YOU SEND MAIL....i
already am....what i asked for was recommendations as to what people felt
were BETTER email handling module ones...if this isn;t the place to ask for
recommendations (as i did when searhcing for a decent IDE) then just say
that.  but really now you're just being nasty to be nasty it seems...

if anyone cares, here was my original message:
--
been doing some email programming, and "sendmail" is simple, easy, quick,
but it seems that there are other modules and am trying to find the most all
around one....

one that let's me get & make attachemtns, easily read headers, etc.

if i just jump into the first i find, i might go down the wrong path....

so i figured i would ask if anyone out there knows of which is the most
used, most raved about type

thanks ahead









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

Date: Mon, 25 Oct 2004 12:18:41 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: MAIL recommendation
Message-Id: <2u4383F26olmiU1@uni-berlin.de>

daniel kaplan wrote:
> been doing some email programming, and "sendmail" is simple, easy,
> quick, but it seems that there are other modules and am trying to
> find the most all around one....
> 
> one that let's me get & make attachemtns, easily read headers, etc.
> 
> if i just jump into the first i find, i might go down the wrong
> path....
> 
> so i figured i would ask if anyone out there knows of which is the
> most used, most raved about type

Mail::Sender and MIME::Lite are two options for sending attachments.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: 25 Oct 2004 04:01:28 -0700
From: mohamed444@gmail.com (Mohd)
Subject: Parsing SGML with Perl
Message-Id: <ec16b074.0410250301.497934e3@posting.google.com>

Hi,

I am very new to Perl and would appreciate if someone can tell me a
way to extract inforamtion from a simple SGML file to HTML using Perl.

Thanks,
-Mohd


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

Date: Mon, 25 Oct 2004 11:18:42 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Parsing SGML with Perl
Message-Id: <mi5fd.2801$jD4.1125@trnddc06>

Mohd wrote:
> I am very new to Perl and would appreciate if someone can tell me a
> way to extract inforamtion from a simple SGML file to HTML using Perl.

This _Q_uestion is _A_sked _F_requently, please check the FAQ:

  How do I remove HTML from a string?
            The most correct way (albeit not the fastest) is to use
            HTML::Parser from CPAN. Another mostly correct way is to use
            HTML::FormatText which not only removes HTML but also attempts
            to do a little simple formatting of the resulting plain text.
    [...]

Well, ok, the question is not exactly identical, but the answer is the same. 
Use a proper module to parse the SGML (I would assume you can even use 
HTML::Parser, it should work on any SGML).

If you don't know how to search the FAQ please see "perldoc perldoc" which 
will explain how to use the perldoc tool itself. And then use "perldoc -q 
KEY" to search for the term "KEY" in the header of any FAQ.
Oh, and while modules usually can be found on CPAN (http://cpan.org) 
HTML::Parser is part of the standard Perl installation already.

jue




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

Date: Mon, 25 Oct 2004 11:41:10 +0000 (UTC)
From: rdwillia@hgmp.mrc.ac.uk (Richard Williams)
Subject: Re: Practical Extraction Recording Language
Message-Id: <clioom$jcu$1@helium.hgmp.mrc.ac.uk>

In article <x7wtxgbq7q.fsf@mail.sysarch.com>,
Uri Guttman  <uri@stemsystems.com> wrote:

>this page is mind boggling. if someone can find an email address, feel
>free to forward my critique.

You can contact her via a link on her homepage:

http://www.unc.edu/~husted/


Richard.



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

Date: Mon, 25 Oct 2004 12:06:10 GMT
From: "Peter Wyzl" <wyzelli@yahoo.com>
Subject: Re: Practical Extraction Recording Language
Message-Id: <S_5fd.38800$5O5.8193@news-server.bigpond.net.au>

"A. Sinan Unur" <usa1@llenroc.ude.invalid> wrote in message 
news:Xns958CE837A2D0asu1cornelledu@132.236.56.8...
> Just for laughs:
>
> http://www.unc.edu/~husted/Work/PerlReference.htm#anchor8

Since the tutorial has been critiqued widely, perhaps some of her code 
too...

From http://www.unc.edu/~husted/Work/password.txt#!/usr/bin/perl
#Lindsay Husted
#password.pl
#July 10, 2003
#this program generates a random password
#
#Generate a random number
print "Enter a seed number: ";
$seed = <STDIN>;
chomp $seed;
srand($seed ^ time);
#Set up a list of consonants and vowels
@consonants= split(/ */, "bcdfghjklmnpqrstvwxyz");
@vowels= split (/ */, "\@310u");
#Loop through the generation of a password
for ($i=1; $i<=4; $i +=1) {
	print $consonants[int(rand(21))],
	$vowels[int(rand(5))];
	}
#EOFFrom http://www.unc.edu/~husted/Work/literals.perl.txt#!/usr/bin/perl
#Program, named literals.perl, written to test special literals
print "We are on line number ",__LINE__,".\n";  #Returns line 	number
print "The name of this file is ",__FILE__,".\n";  #Returns file 	name
__END__

#Must use a double underscore at the front and back of the word
_____-- Wyzelli${^__}=[qw(Just another Perl Hacker)];print "@{[@{${^__}}]}"; 




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

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


Administrivia:

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

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

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

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

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


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


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