[12527] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6127 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 25 13:07:11 1999

Date: Fri, 25 Jun 99 10:00:24 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 25 Jun 1999     Volume: 8 Number: 6127

Today's topics:
        'tr/ / /s; myfile.txt won't work j_a_p@my-deja.com
        ASCII character coversion (Steve .)
    Re: ASCII character coversion <gellyfish@gellyfish.com>
    Re: ASCII character coversion <flavell@mail.cern.ch>
    Re: ASCII character coversion <rootbeer@redcat.com>
    Re: Can't retain a directory change from within a scrip <rootbeer@redcat.com>
        can't save process output.. amidalla@my-deja.com
    Re: can't save process output.. <rootbeer@redcat.com>
    Re: Escape Newline ? <bivey@teamdev.com>
    Re: Escape Newline ? <bivey@teamdev.com>
    Re: how do I save an MD5 checksum? <sb@sdm.de>
    Re: How to access MS Access using perl/cgi/unix <gellyfish@gellyfish.com>
        Keeping trake of file postion <shaddy@shaddy.com>
        Mail Filter <rbeaver@home.com>
    Re: Mail Filter <rootbeer@redcat.com>
        Perl utility pandey@my-deja.com
    Re: Perl utility <gellyfish@gellyfish.com>
    Re: Perl utility <swiftkid@bigfoot.com>
    Re: Perl utility <rootbeer@redcat.com>
        preventing echo during user input resark@my-deja.com
    Re: preventing echo during user input <gbartels@xli.com>
        Problem with regular expression <tis5miwa@fht-esslingen.de>
        Question about hashes and lists (Joan Richards)
    Re: Regex question (i think) (Bart Lateur)
    Re: Regex question (i think) <rootbeer@redcat.com>
    Re: Regex question (i think) <rootbeer@redcat.com>
        Regular expressions eliot5581@my-deja.com
    Re: Regular expressions jperez9@hotmail.com
    Re: Regular expressions <rootbeer@redcat.com>
        syntax check without execution <gbartels@xli.com>
        The Perlfaq Man Can! (was: problems with chmod function <tchrist@mox.perl.com>
    Re: validating a regexp from a CGI form <macintsh@cs.bu.edu>
    Re: validating a regexp from a CGI form <rootbeer@redcat.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Fri, 25 Jun 1999 16:12:32 GMT
From: j_a_p@my-deja.com
Subject: 'tr/ / /s; myfile.txt won't work
Message-Id: <7l09p5$87s$1@nnrp1.deja.com>

I have written a search engine that looks into a textfile and finds
prints out the results if found.  However my problem is that since I
converted the text file from excell there are a lot of empty spaces
after my delimeter (::).  I need to remove these spaces but not the
spaces between the words.
For Example

text::    text  :: text:: text text::  text text text::
       ^       ^  ^      ^            ^
       |       |  |      |            |
    remove     remove    remove      remove
I need to remove all of these spaces.  I tried using
perl -ne 'tr/ / /s;' myfile.txt, but this isn't working. Does anyone
know what I am doing wrong?


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 25 Jun 1999 15:45:47 GMT
From: syarbrou@nospam.enteract.com (Steve .)
Subject: ASCII character coversion
Message-Id: <3773a3c3.5857447@news.enteract.com>

I have the character P.  I am redoing a program that uses ascii
conversions was told by the original programmer that the ascii value
should be 0x50.  I get an ord value of 80.  What am I missing here?
Thanks.

Steve

Newsgroup replies preferred.  When responding thru email remove nospam
from the address.


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

Date: 25 Jun 1999 17:00:39 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: ASCII character coversion
Message-Id: <3773a7a7@newsread3.dircon.co.uk>

Steve . <syarbrou@nospam.enteract.com> wrote:
> I have the character P.  I am redoing a program that uses ascii
> conversions was told by the original programmer that the ascii value
> should be 0x50.  I get an ord value of 80.  What am I missing here?
> Thanks.
> 


ASCII(7)            Linux Programmer's Manual            ASCII(7)


NAME
       ascii - the ASCII character set encoded in octal, decimal,
       and hexadecimal

DESCRIPTION
       ASCII is the American Standard Code for Information Inter-
       change.  It is a 7-bit code. Many 8-bit codes (such as ISO
       8859-1, the Linux default character set) contain ASCII  as
       their  lower half.  The international counterpart of ASCII
       is known as ISO 646.

       The following table contains the 128 ASCII characters.

       C program '\X' escapes are noted.

       Oct   Dec   Hex   Char           Oct   Dec   Hex   Char
       ------------------------------------------------------------
       000   0     00    NUL '\0'       100   64    40    @
       001   1     01    SOH            101   65    41    A
       002   2     02    STX            102   66    42    B
       003   3     03    ETX            103   67    43    C
       004   4     04    EOT            104   68    44    D
       005   5     05    ENQ            105   69    45    E
       006   6     06    ACK            106   70    46    F
       007   7     07    BEL '\a'       107   71    47    G
       010   8     08    BS  '\b'       110   72    48    H
       011   9     09    HT  '\t'       111   73    49    I
       012   10    0A    LF  '\n'       112   74    4A    J
       013   11    0B    VT  '\v'       113   75    4B    K
       014   12    0C    FF  '\f'       114   76    4C    L
       015   13    0D    CR  '\r'       115   77    4D    M
       016   14    0E    SO             116   78    4E    N
       017   15    0F    SI             117   79    4F    O
       020   16    10    DLE            120   80    50    P
       021   17    11    DC1            121   81    51    Q
       022   18    12    DC2            122   82    52    R
       023   19    13    DC3            123   83    53    S
       024   20    14    DC4            124   84    54    T
       025   21    15    NAK            125   85    55    U
       026   22    16    SYN            126   86    56    V
       027   23    17    ETB            127   87    57    W
       030   24    18    CAN            130   88    58    X
       031   25    19    EM             131   89    59    Y
       032   26    1A    SUB            132   90    5A    Z
       033   27    1B    ESC            133   91    5B    [
       034   28    1C    FS             134   92    5C    \   '\\'
       035   29    1D    GS             135   93    5D    ]
       036   30    1E    RS             136   94    5E    ^
       037   31    1F    US             137   95    5F    _
       040   32    20    SPACE          140   96    60    `
       041   33    21    !              141   97    61    a
       042   34    22    "              142   98    62    b
       043   35    23    #              143   99    63    c




Linux                   December 18, 1996                       1





ASCII(7)            Linux Programmer's Manual            ASCII(7)


       044   36    24    $              144   100   64    d
       045   37    25    %              145   101   65    e
       046   38    26    &              146   102   66    f
       047   39    27    '              147   103   67    g
       050   40    28    (              150   104   68    h
       051   41    29    )              151   105   69    i
       052   42    2A    *              152   106   6A    j
       053   43    2B    +              153   107   6B    k
       054   44    2C    ,              154   108   6C    l
       055   45    2D    -              155   109   6D    m
       056   46    2E    .              156   110   6E    n
       057   47    2F    /              157   111   6F    o
       060   48    30    0              160   112   70    p
       061   49    31    1              161   113   71    q
       062   50    32    2              162   114   72    r
       063   51    33    3              163   115   73    s
       064   52    34    4              164   116   74    t
       065   53    35    5              165   117   75    u
       066   54    36    6              166   118   76    v
       067   55    37    7              167   119   77    w
       070   56    38    8              170   120   78    x
       071   57    39    9              171   121   79    y
       072   58    3A    :              172   122   7A    z
       073   59    3B    ;              173   123   7B    {
       074   60    3C    <              174   124   7C    |
       075   61    3D    =              175   125   7D    }
       076   62    3E    >              176   126   7E    ~
       077   63    3F    ?              177   127   7F    DEL


/J\
-- 
"I'm not Carol Vorderman - you wouldn't see me getting drunk in a kebab
shop" - Lily Savage


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

Date: Fri, 25 Jun 1999 17:51:44 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: ASCII character coversion
Message-Id: <Pine.HPP.3.95a.990625175130.9104B-100000@hpplus03.cern.ch>

On Fri, 25 Jun 1999, Steve . wrote:

> I have the character P.  I am redoing a program that uses ascii
> conversions was told by the original programmer that the ascii value
> should be 0x50.  I get an ord value of 80.  What am I missing here?

Sweet sixteen?




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

Date: Fri, 25 Jun 1999 09:24:24 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: ASCII character coversion
Message-Id: <Pine.GSO.4.02A.9906250921500.6929-100000@user2.teleport.com>

On Fri, 25 Jun 1999, Steve . wrote:

> I have the character P.  I am redoing a program that uses ascii
> conversions was told by the original programmer that the ascii value
> should be 0x50.  I get an ord value of 80.  What am I missing here?

Oh, so many things! :-)

Look up the meaning of 0x50 in the perldata manpage, and the docs for the
ord and chr functions in perlfunc to get started. And maybe pack (in
perlfunc) as well. 

Enjoy!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 25 Jun 1999 08:02:30 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Can't retain a directory change from within a script!
Message-Id: <Pine.GSO.4.02A.9906250758040.6929-100000@user2.teleport.com>

On Fri, 25 Jun 1999, Paul D Enderson wrote:

> Newsgroups: alt.perl, comp.lang.perl.misc, comp.lang.perl.modules,
>     comp.lang.perl.tk

That's N newsgroups too many. Since your answer can be found in the FAQ, N
equals four. But I've set followups to c.l.p.misc.

> The problem I am having is that when I change directory from within the 
> script, and then exit the script, the directory change has been lost.

Look in section eight of the FAQ.

> Please CC to my email address:
> 
> 	techsup(at)datascan.co.uk

I'd rather use the correct address from your headers. Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 25 Jun 1999 15:43:11 GMT
From: amidalla@my-deja.com
Subject: can't save process output..
Message-Id: <7l082d$7eo$1@nnrp1.deja.com>

If the program being initiated is a simple perl script with output, it
works just fine, but with this program running, it's output just gets
displayed to the screen and never saved to the $output variable..

I'm trying to gather output like this..

open(README, "looper.exe -URTS_DEBUG=quit |")
or die "Cant run program: $!\n";
while(<README>) {
$output .= $_;
}
close (README);

why doesn't this work??  Suspect looper.exe writes to STDERR but still
can't capture it's output.  I tried just about every method listed in
perlfaq8-> "How can I capture STDERR from an external command?"

my ultimate goal is to see if the process (looper.exe) has run to
completion. I use Win32::Process::Create to start the process, but I
can't seem to get different exit code for a process that is terminated
via the $ProcessObj->Kill function as opposed to a proper exit due to
the process successfully ending.
I was looking at the Expect module but couldn't get it in a windows
format.
Thanks for any help..


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 25 Jun 1999 09:35:38 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: can't save process output..
Message-Id: <Pine.GSO.4.02A.9906250934240.6929-100000@user2.teleport.com>

On Fri, 25 Jun 1999 amidalla@my-deja.com wrote:

> If the program being initiated is a simple perl script with output, it
> works just fine, but with this program running, it's output just gets
> displayed to the screen and never saved to the $output variable..

It sounds as if the program in question is not writing to standard output.
If it's supposed to be callable from other programs like this, maybe you
should complain to its author.

> I was looking at the Expect module but couldn't get it in a windows
> format.

Maybe it would be easier to port Expect to Windows, or to upgrade to
Linux. Good luck with it!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 25 Jun 1999 15:43:13 GMT
From: "William" <bivey@teamdev.com>
Subject: Re: Escape Newline ?
Message-Id: <01bebf21$7c531c00$583c08cf@bill.jump.net>

Tom Phoenix <rootbeer@redcat.com> wrote in article
<Pine.GSO.4.02A.9906250724490.6929-100000@user2.teleport.com>...
> On Fri, 25 Jun 1999, Helmut Jarausch wrote:
> 
> > Is there any (elegant) method to escape a newline?
> 
> I think you want to write a literal string on multiple lines and then
> combine the lines into a single line within a variable. Here are a few
> (not quite identical) ways.

Here's another (which more closely resembles what I would
do in C):

my $string =  "Here's line one ".
			"and line two".	#Comments are fine
			"and yet another line.";

-Wm


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

Date: 25 Jun 1999 15:48:00 GMT
From: "William" <bivey@teamdev.com>
Subject: Re: Escape Newline ?
Message-Id: <01bebf22$27485e40$583c08cf@bill.jump.net>

Oops, should have look further upstream, this is what
the original poster suggested. (I still think it's
the best solution for many cases as long as you indent
nicely.)-Wm

William <bivey@teamdev.com> wrote in article
<01bebf21$7c531c00$583c08cf@bill.jump.net>...
> Here's another (which more closely resembles what I would
> do in C):
> 
> my $string =  "Here's line one ".
> 			"and line two".	#Comments are fine
> 			"and yet another line.";
> 
> -Wm
> 


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

Date: 25 Jun 1999 15:02:58 GMT
From: Steffen Beyer <sb@sdm.de>
Subject: Re: how do I save an MD5 checksum?
Message-Id: <7l05n2$l8g$2@solti3.sdm.de>

In article <3773C33E.F419AEBD@fast.no>, kev <kevin.porter@fast.no> wrote:

> I'm using an MD5 checksum to determine whether a web page has changed
> since my web client prog last visited it.
> The checksum can contain some weird characters which I'd like to escape
> before putting it in a file. What is the usual method for doing this?

You probably want the
         $string = $context->hexdigest();
method instead of the
         $digest = $context->digest();
method.

Read the MD5 manpage.

-- 
    Steffen Beyer <sb@engelschall.com>
    http://www.engelschall.com/u/sb/whoami/
    http://www.engelschall.com/u/sb/download/
    http://www.perl.com/CPAN/authors/id/STBEY/
    http://www.oreilly.de/catalog/perlmodger/bnp/


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

Date: 25 Jun 1999 16:35:17 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How to access MS Access using perl/cgi/unix
Message-Id: <3773a1b5@newsread3.dircon.co.uk>

Olivier Maas <olivier.maas@at-lci.com> wrote:
> 
> 
> Bruce Chao a icrit :
> 
>> Hi,
>>
>> Is there any way that I can connect to MS Access
>> from a Netscape Server on Unix platform using /Perl/Cgi???
>>
>> Thanks!
> 
> Try that, but not sure...
> 
> use Win32::OLE;
>    $application=Win32::OLE->new('Access.Application', 'Quit') || warn
> "Impossible de cr&eacute;er un objet OLE";
> 
> 

Not on Unix you dont ....

/J\
-- 
"You don't watch the Eurovision Song Contest to hear good music" -
Katrina Leskanich, Katrina and the Waves


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

Date: Fri, 25 Jun 1999 16:04:51 GMT
From: "Shaddy International Ltd." <shaddy@shaddy.com>
Subject: Keeping trake of file postion
Message-Id: <3773A85B.93AA2E3B@shaddy.com>

This is a multi-part message in MIME format.
--------------B0E7BFC55EF43D593B6B1C64
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hey gang I got a question for yeah

I've been working on this CGI program for an online search page using
perl.
I've run into a snag. The way my scripts works it gets the string from a
HTML form and then checks very line in my text data file for that
string. When found the script writes that line to a temp file. Now
here's where I'm running into problems. I want to be able to output 20
hits at a time. (Kinda like yahoo and all the other search engines out
there, but I can't figure out how it keep track of my position in the
file and restart from that position. e.g. script finds 100 matching
records, outputs those records to a temp file. I want it to then display
the first 20 records outs thetemp file to the clients browser and allow
them to click a button to get the next 20 matchs. Is this possible using
perl? If so can sombody please give me some pointers on how to do this.


Thanks
Jason

--------------B0E7BFC55EF43D593B6B1C64
Content-Type: text/x-vcard; charset=us-ascii;
 name="shaddy.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Shaddy International Ltd.
Content-Disposition: attachment;
 filename="shaddy.vcf"

begin:vcard 
n:;Shaddy Int'l Marketing LTD.
x-mozilla-html:FALSE
version:2.1
email;internet:shaddy@shaddy.com
x-mozilla-cpt:;0
fn:Shaddy Int'l Marketing LTD.
end:vcard

--------------B0E7BFC55EF43D593B6B1C64--



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

Date: Fri, 25 Jun 1999 10:49:19 -0500
From: Robert Beaver <rbeaver@home.com>
Subject: Mail Filter
Message-Id: <3773A4FE.D3B8B9CF@home.com>

I'm trying to write a mail filter to expire old aliases/userids on a
UNIX platform.  Basically, I want my email aliases to read somthing
like:

robert: robert@host.domain.com
bob: robert,expire
expire: "| mail_filter_program"

I want the  mail filter program to forward the message on to robert,
send a message to the sender indicating that bob is changing to robert,
and send a message to robert indicating that he should notify the
sender.

I have it all working, however, I'm having trouble pulling the "to"
address out of the message.  I've deterimined that the To: line of the
message comes in multiple flavors (probably more than this, that's why
I'm looking for a different solution):

To: bob@host.domain.com
To: <bob@host.domain.com>
To: "Robert Beaver" <bob@host.domain.com>
To: joe@host.domain.com; bob@host.domain.com

I'm having the most problems with the last item.  I believe there has to
be an easier way to extract the recipient in questioin from the To
line.   Any one have any ideas or solutions?

Thanks
Bob

--
Robert L. Beaver |"Nothing contributes more to peace of soul than having no
      )          |opinion at all."  - Georg Cristoph Lichtenberg, Aphorisms
o====={xxxxxxxxx>|---------------------------------------------------------
      )          |"Iron rusts from disuse...even so does inaction sap the
UNIX System Admin|vigor of the mind." - Leonardo Da Vinci, The Notebooks





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

Date: Fri, 25 Jun 1999 09:28:08 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Mail Filter
Message-Id: <Pine.GSO.4.02A.9906250925060.6929-100000@user2.teleport.com>

On Fri, 25 Jun 1999, Robert Beaver wrote:

> To: joe@host.domain.com; bob@host.domain.com
> 
> I'm having the most problems with the last item.  I believe there has
> to be an easier way to extract the recipient in questioin from the To
> line.  Any one have any ideas or solutions?

It sounds as if you're needing to parse that line to determine the
addresses. See whether Mail::Internet (from CPAN) will help you out. Good
luck!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 25 Jun 1999 15:11:01 GMT
From: pandey@my-deja.com
Subject: Perl utility
Message-Id: <7l065p$6l1$1@nnrp1.deja.com>

Hi,
I am writing a perl utility that scans mails for
some user specified conditions. It scans for keywords
and FROM conditions etc. It then filters out the
mails to some directory. Is this possible in Perl.

Can somebody point out how to do this.

Thanks
Pandey


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 25 Jun 1999 16:48:03 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl utility
Message-Id: <3773a4b3@newsread3.dircon.co.uk>

pandey@my-deja.com wrote:
> Hi,
> I am writing a perl utility that scans mails for
> some user specified conditions. It scans for keywords
> and FROM conditions etc. It then filters out the
> mails to some directory. Is this possible in Perl.
> 
> Can somebody point out how to do this.
> 

You could do it in Perl but why not use procmail ...

/J\
-- 
"Like Anne Robinson in a Korean restaurant, it'll be dog eat dog" -
Graham Norton


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

Date: Fri, 25 Jun 1999 20:27:15 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: Perl utility
Message-Id: <7l1acb$9n1@news.cyber.net.pk>

Man Mail::POP3Client

<pandey@my-deja.com> wrote in message news:7l065p$6l1$1@nnrp1.deja.com...
> Hi,
> I am writing a perl utility that scans mails for
> some user specified conditions. It scans for keywords
> and FROM conditions etc. It then filters out the
> mails to some directory. Is this possible in Perl.
>
> Can somebody point out how to do this.
>
> Thanks
> Pandey
>
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.




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

Date: Fri, 25 Jun 1999 09:10:15 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Perl utility
Message-Id: <Pine.GSO.4.02A.9906250907000.6929-100000@user2.teleport.com>

On Fri, 25 Jun 1999 pandey@my-deja.com wrote:

> I am writing a perl utility that scans mails for some user specified
> conditions. It scans for keywords and FROM conditions etc. It then
> filters out the mails to some directory. Is this possible in Perl.

Yes, it is possible.

> Can somebody point out how to do this.

You should probably look through the manpages and FAQs for Perl first,
then let us know what part of your project is giving you trouble. For
example, if the trouble is in trying to scan for keywords, I'd probably
recommend that you read about patterns and hashes. 

Also, there are some modules on CPAN which may prove helpful.

Do you already know how to find what you want in the manpages and FAQs,
and on CPAN?

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 25 Jun 1999 14:59:09 GMT
From: resark@my-deja.com
Subject: preventing echo during user input
Message-Id: <7l05fk$68v$1@nnrp1.deja.com>

I need to prevent what is being input by the user from being echoed (a
password in a login prompt)

I know is it possible with a system call (stty -echo), but I know there is a
better way that does not involve system calls.	I was pointed to the
Term::ReadLine module, but have been unable to find information on how to
make it work in this way.

Any help would be greatley appreciated.

Keith Resar


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 25 Jun 1999 10:48:46 -0400
From: Greg Bartels <gbartels@xli.com>
Subject: Re: preventing echo during user input
Message-Id: <377396CE.437A326D@xli.com>

resark@my-deja.com wrote:
> I need to prevent what is being input by the user from being echoed (a
> password in a login prompt)

I just packed up all my books for moving, so I cant
give you the exact answer. but I can tell you its
in a book published by O'Reilly called
"Perl Cookbook". Highly recommended source of 
"how do I do ___?" with all teh answers.

Greg


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

Date: Fri, 25 Jun 1999 18:33:31 +0200
From: Michael Wahl <tis5miwa@fht-esslingen.de>
Subject: Problem with regular expression
Message-Id: <3773AF5B.349C3E96@fht-esslingen.de>

Hi All,

I have a problem with a regular expression.
First some code

my $line = "Port 2 Out of Paper";
my $line2 = "Port 2 Offline";

if( $line =~ /regexp/) {
 print "1:got <$&>\n";
}

if( $line2 =~ /regexp/) {
 print "2:got <$&>\n";
}

The regexp in the if conditions should be the same. In the above example I have
2 strings.
Now the regexp should find the strings but only if it doesn't contain the word
"Paper". So
for the above example it should jump over the first if-condition but jump into
the second
if-condition. I tried several regexp but with no success.  The same should be
done if the word
is not at the end  but somewhere in the string. Could somebody tell me how the
regexp
should look so that the string $line2 is recognized but not the string $line.
Any help would be great.

Michael





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

Date: Fri, 25 Jun 1999 16:37:45 GMT
From: richj@home.com (Joan Richards)
Subject: Question about hashes and lists
Message-Id: <37733f03.79107039@24.0.3.71>

I'm trying to do some stuff with hashes of lists.  i am able to easily
create the hash of lists.  but, i can't seem to delete an entry.  i am
creating an entry into the hash by doing - push @{ $hash{$list} },
$parm;  and then i try to delete an entry from the list by doing -
delete $hash{$list}{parm}.  however, this doesn't seem to remove the
entry from the list.  

what am i doing wrong?

-J


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

Date: Fri, 25 Jun 1999 15:04:19 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Regex question (i think)
Message-Id: <37769a55.2041287@news.skynet.be>

Tom Phoenix wrote:

>    <"fred@barney"@redcat.com (Yes, "fred@barney" is correct!)>

I thought it was <fred&barney@redcat.com>. Just how many variations on
this one address are there?

OTOH, this e-mail address does have a legal format.

	Bart.


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

Date: Fri, 25 Jun 1999 08:14:46 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Regex question (i think)
Message-Id: <Pine.GSO.4.02A.9906250812240.6929-100000@user2.teleport.com>

On Fri, 25 Jun 1999, Henry Vermeulen wrote:

> Looks quit tough to deal with but can be done with a 'if then' i think.

I think you're talking about a full parser for e-mail addresses. You're
right, that's one way to do it. And if you look on CPAN, you might even
find a module which implements RFC822 for you. Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 25 Jun 1999 09:06:33 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Regex question (i think)
Message-Id: <Pine.GSO.4.02A.9906250900200.6929-100000@user2.teleport.com>

On Fri, 25 Jun 1999, Bart Lateur wrote:

> Tom Phoenix wrote:
> 
> >    <"fred@barney"@redcat.com (Yes, "fred@barney" is correct!)>
> 
> I thought it was <fred&barney@redcat.com>. Just how many variations on
> this one address are there?

Here are aleph-null - let me know when these run out. :-)

    print "<fred${_}barney\@redcat.com>\n" while ++$_;

These come in handy when someone's "voting" website insists on a unique
e-mail address for each vote cast. Feel free to use these addresses for
that - I've got another aleph-null around here somewhere....

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 25 Jun 1999 15:04:25 GMT
From: eliot5581@my-deja.com
Subject: Regular expressions
Message-Id: <7l05pe$6dr$1@nnrp1.deja.com>

Hi,

I'm fairly new to Perl and have come up against a problem with regard
to regular expressions.

What I want to do is grab from an HTML file the first entry of the form
<TABLE>
 .
 .
any html goes here
 .
 .
</TABLE>

Any hints on how I can get this info. via a regular expression, or a
better way of doing it would be appreciated.

Thanks

Eliot


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 25 Jun 1999 15:43:37 GMT
From: jperez9@hotmail.com
Subject: Re: Regular expressions
Message-Id: <7l0836$7et$1@nnrp1.deja.com>

In article <7l05pe$6dr$1@nnrp1.deja.com>,
  eliot5581@my-deja.com wrote:
> Hi,
>
> I'm fairly new to Perl and have come up against a problem with regard
> to regular expressions.
>
> What I want to do is grab from an HTML file the first entry of the
form
> <TABLE>
> .
> .
> any html goes here
> .
> .
> </TABLE>
>
> Any hints on how I can get this info. via a regular expression, or a
> better way of doing it would be appreciated.
>
> Thanks
>
> Eliot
>
First I would like to direct you to the web site www.webteacher.com.
It has a good tutorial on how to get started in perl.  What it will
show you is to put all of your input into an array with a field
delimeter.  After you do this you can access any of the elements in the
array by index number that way you can specify which one you want to
use.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 25 Jun 1999 08:59:50 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Regular expressions
Message-Id: <Pine.GSO.4.02A.9906250858410.6929-100000@user2.teleport.com>

On Fri, 25 Jun 1999 eliot5581@my-deja.com wrote:

> Subject: Regular expressions

You should try to pick a more specific subject than that one, in general.

> What I want to do is grab from an HTML file 

HTML is too complex to parse with a simple regular expression. You
probably want HTML::Parser from CPAN. Enjoy!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 25 Jun 1999 10:55:56 -0400
From: Greg Bartels <gbartels@xli.com>
Subject: syntax check without execution
Message-Id: <3773987C.EA5197A0@xli.com>

is there a way to syntax check a file
with perl code in it without actually 
executing it. is there a hook into 
'eval' or something
that would let me do this?

Greg


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

Date: 25 Jun 1999 09:11:26 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: The Perlfaq Man Can! (was: problems with chmod function)
Message-Id: <37739c1e@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, bismuti@cs.fsu.edu (Peter Bismuti) writes:
:I tried using the chmod function
:     chmod($perm,$filename)
:where the striung $perm = '0775' for example.  This didn't
:work like I thought it should, it set the permissions to all
:kinds of bizarre values. Can anyone explain why?  

Who can take your question
    Check for something new
Cover with with answers
    And a bit of pod or two?

The Perlfaq Man!
    The Perlfaq Man can!
The Perlfaq Man can 'cause he mixes it with docs
    And makes your Perl taste good!

Who can take a quandary
    Wrap it in a sigh 
Soak it in a pun
    And make your program really fly?

The Perlfaq Man!
    The Perlfaq Man can!
The Perlfaq Man can 'cause he mixes it with docs
    And makes your Perl taste good!

The Perlfaq Man makes 
    All your code that breaks 
Happifying and propitious
    Talk about your hackish wishes 
You might even get ambitious.

Who can take confusion
    From code that needs to run
Chase away delusion 
    And do it in all in fun?

The Perlfaq Man!
    The Perlfaq Man can!
The Perlfaq Man can 'cause he mixes it with docs
    And makes your Perl taste good!

% man perlfaq4

 ...

  Why isn't my octal data interpreted correctly?

    Perl only understands octal and hex numbers as such when they
    occur as literals in your program. If they are read in from
    somewhere and assigned, no automatic conversion takes place. You
    must explicitly use oct() or hex() if you want the values
    converted. oct() interprets both hex ("0x350") numbers and octal
    ones ("0350" or even without the leading "0", like "377"), while
    hex() only converts hexadecimal ones, with or without a leading
    "0x", like "0x255", "3A", "ff", or "deadbeef".

    This problem shows up most often when people try using chmod(),
    mkdir(), umask(), or sysopen(), which all want permissions in
    octal.

        chmod(644,  $file); # WRONG -- perl -w catches this
        chmod(0644, $file); # right


-- 
Someone who truly understands Unix not only understands why "rm *"    
screws you, but understands why IT HAS TO BE THAT WAY.


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

Date: 25 Jun 1999 15:07:27 GMT
From: John Siracusa <macintsh@cs.bu.edu>
Subject: Re: validating a regexp from a CGI form
Message-Id: <7l05vf$9dn$1@news1.bu.edu>

Tom Phoenix <rootbeer@redcat.com> wrote:
>     sub bad_pattern ($) {
> 	my $pat = shift;
> 	eval { '' =~ /$pat/ };
> 	$@;
>     }

Is there a reason you've the empty string and =~ in there?

-----------------+----------------------------------------
  John Siracusa  | If you only have a hammer, you tend to
 macintsh@bu.edu | see every problem as a nail. -- Maslow



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

Date: Fri, 25 Jun 1999 08:58:00 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: validating a regexp from a CGI form
Message-Id: <Pine.GSO.4.02A.9906250857170.6929-100000@user2.teleport.com>

On 25 Jun 1999, John Siracusa wrote:

> Tom Phoenix <rootbeer@redcat.com> wrote:
> >     sub bad_pattern ($) {
> > 	my $pat = shift;
> > 	eval { '' =~ /$pat/ };
> > 	$@;
> >     }
> 
> Is there a reason you've the empty string and =~ in there?

Yes. :-)

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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