[28836] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 80 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 26 21:06:11 2007

Date: Fri, 26 Jan 2007 18:05:06 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 26 Jan 2007     Volume: 11 Number: 80

Today's topics:
    Re: Bus error <jgibson@mail.arc.nasa.gov>
        Clickable mail link? lnp3@columbia.edu
    Re: Clickable mail link? <nobull67@gmail.com>
    Re: Clickable mail link? <cwilbur@chromatico.net>
        custom regexp modifiers <lechnerj@colorado.edu>
    Re: custom regexp modifiers <paul@probulletin.com>
    Re: custom regexp modifiers <paul@probulletin.com>
    Re: Fork in windows <bik.mido@tiscalinet.it>
    Re: Hash of Hashes <doni.sekar@gmail.com>
    Re: How can I convert a scalar to a range list ??? <nobull67@gmail.com>
    Re: How can I convert a scalar to a range list ??? <tzz@lifelogs.com>
    Re: Net::FTPSSL problem (or how to do FTP over SSL anot <sisyphus1@nomail.afraid.com>
    Re: Removing HTML <m@remove.this.part.rtij.nl>
    Re: Sort on multiple values <bik.mido@tiscalinet.it>
    Re: Statistics Extraction <doni.sekar@gmail.com>
    Re: Statistics Extraction <ch.l.ngre@online.de>
    Re: String Substitution question <LtCommander@gmail.com>
        Using Expect to spawn an interactive tool mailbox@cpacker.org
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 26 Jan 2007 11:00:30 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Bus error
Message-Id: <260120071100301340%jgibson@mail.arc.nasa.gov>

In article <1169780311.365367.150850@a75g2000cwd.googlegroups.com>,
pallav <pallavgupta@gmail.com> wrote:

> I have to MAC OS X machines running 10.4.8 (tiger) with perl version
> 5.8.6. I have a gradebook script that computes some statistics to
> student grades etc.
> 
> When I run this script on one machine, everything runs fine. But on the
> second machine,
> I continually get a "Bus error" and there is no diagnostics so I don't
> know what to do from here.

Bus error is usually a memory address outside your usable address
space. It is rare to see this error in a Perl program. Congratulations!

Bus error would be more likely to be in C code. You call modules such
as GD::Graph that may have a C component. I have never been able to
successfully install and run GD::Graph on a Mac, so maybe the problem
is a broken GD::Graph installation on the bad system.

Try running your program under a debugger such as gdb. I haven't
actually done this myself, but the following seems to work:

  gdb perl
  (gdb) run program.pl

See if that tells you where the problem is (I can't duplicate your
results because I don't have the myXML.pm module or the required data
file).

> 
> I looked at the versions of perl. The only difference I could find is
> the following:
> 
> <     uname='darwin b01.apple.com 8.0 darwin kernel version 8.3.0: mon
> oct 3 20:04:04 pdt 2005; root:xnu-792.6.22.obj~2release_ppc power
> macintosh powerpc '
> ---
> >     uname='darwin b14.apple.com 8.0 darwin kernel version 8.3.0: mon oct 3
> >     20:04:04 pdt 2005; root:xnu-792.6.22.obj~2release_ppc power macintosh
> >     powerpc '
> 37d36
> <       SPRINTF0 - fixes for sprintf formatting issues - CVE-2005-3962

You are also using lots of modules. See if the versions of all of those
are the same. And those modules might call external libraries, such as
the gd library. See if the versions of those are all the same, too.

The program you have posted is too long, contains extraneous material
not pertinent to your problem, requires too many modules, requires a
specific module that you have not provided, and needs data from
external files that you have not provided. I made an attempt to
reproduce your problem, but of course didn't get too far.

Your program also had problems with truncated lines, comment lines that
don't begin with '#', and line-wrap problems (wrapped comments, for
example). While some of these may be due to my newsreader, others may
have similar problems. Try to keep posted lines shorter than 80
characters.

Please reduce your program to the smallest example that demonstrates
your problem. For example, eliminate the usage subroutine. Then
eliminate 1) the graphing, 2) the e-mail.

In the process of eliminating things, you will probably find that your
program stops crashing. This will help you isolate the problem. Once
you have done that, post again for more help.

 Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
    ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------        
                http://www.usenet.com


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

Date: 26 Jan 2007 09:19:59 -0800
From: lnp3@columbia.edu
Subject: Clickable mail link?
Message-Id: <1169831999.572297.142180@v33g2000cwv.googlegroups.com>

I am using a perl script to send mail to a list of users with a
statement that says something like "For assistance, contact the
helpdesk at consultant\@xyz.com." This works okay, but
"consultant@xyz.com" is not clickable when it arrives in the email
client. Is there any way to enable this? I have used perl to generate
web pages, but I am not sure that html type capabilities exist for
plain-vanilla perl scripts such as the one I am describing.



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

Date: 26 Jan 2007 09:29:46 -0800
From: "Brian McCauley" <nobull67@gmail.com>
Subject: Re: Clickable mail link?
Message-Id: <1169832586.640344.178390@l53g2000cwa.googlegroups.com>



On Jan 26, 5:19 pm, l...@columbia.edu wrote:
> I am using a perl script to send mail to a list of users with a
> statement that says something like "For assistance, contact the
> helpdesk at consultant\@xyz.com." This works okay, but
> "consult...@xyz.com" is not clickable when it arrives in the email
> client. Is there any way to enable this? I have used perl to generate
> web pages, but I am not sure that html type capabilities exist for
> plain-vanilla perl scripts such as the one I am describing.

You can't have a "clickable" something in a plain text mail. (This has
nothing to do with Perl).

Making an email HTML is a simple as giving it a content-type header
(then producing a valid HTML document as the message body).

Note that unless you know the recepients will all be using HTML capable
MUAs then you should probably be sending MIME multipart/alternative.

The MIME::* modules on CPAN would probably be a good place to start.



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

Date: 26 Jan 2007 13:01:35 -0500
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: Clickable mail link?
Message-Id: <87zm85vf9c.fsf@mithril.chromatico.net>

>>>>> "BMcC" == Brian McCauley <nobull67@gmail.com> writes:

    BMcC> You can't have a "clickable" something in a plain text
    BMcC> mail. (This has nothing to do with Perl).

Pedantry: you can't force the MUA to allow the user to click on
something, but many MUAs will recognize email addresses and allow the
user to click on them, even in plain-text emails.

You are correct, however, in that this has nothing do do with Perl,
and in that the best solution is to send multipart/alternative emails.

Charlton



-- 
Charlton Wilbur
cwilbur@chromatico.net


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

Date: 26 Jan 2007 15:40:46 -0800
From: "Josef Lechner" <lechnerj@colorado.edu>
Subject: custom regexp modifiers
Message-Id: <1169854846.507793.121270@v33g2000cwv.googlegroups.com>

I have to compare pathnames that use different formats; Windows
(.\foo\bar), UNIX (./foo/bar), and sometimes mixed (.\foo/bar).  To my
script, all of those pathnames in parentheses are equivalent.  However,
perl's regular expressions do not see it that way.  The way I've been
handling this is by first converting to UNIX style then comparing.

This works fine, but it really irks me that this is really no different
from what the /i modifier does, in that the /i modifier just treats
upper and lower case letters as if they're the same.  I think it is
reasonable to want to do the same sort of deal with different
characters (i.e. /'s and \'s).  So, is there a way to make my own
modifiers?  perlre mentions (near the end) that qr// can be overloaded
to make your own escape sequences but I'm not sure if this strategy
would work for me.



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

Date: 26 Jan 2007 16:38:43 -0800
From: "Paul" <paul@probulletin.com>
Subject: Re: custom regexp modifiers
Message-Id: <1169858323.372123.108640@q2g2000cwa.googlegroups.com>

I think the easiest way is the way you are doing it, by converting all
paths to the same format before comparing them.

$path =~ s|[\\\/]|/|sg;



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

Date: 26 Jan 2007 16:41:28 -0800
From: "Paul" <paul@probulletin.com>
Subject: Re: custom regexp modifiers
Message-Id: <1169858488.578412.33940@m58g2000cwm.googlegroups.com>

Actually the following may be better:


$path =~ s|\\(?:\\)?|/|sg;



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

Date: Fri, 26 Jan 2007 18:02:23 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Fork in windows
Message-Id: <kockr2942vhmb9jb1fatkssn29kjpk8bga@4ax.com>

On 26 Jan 2007 05:33:21 -0800, "lala4life" <rafael.avaria@gmail.com>
wrote:

>Hi gurus.
>     I have some code using fork, work nice in linux. but it really
>portable to win32?

I don't know how portable it is, but rumors have it that fork() is
emulated under Windows. For more info, and in particular to see if
that emulation is good enough for you, read

  perldoc perlfork


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: 26 Jan 2007 09:33:26 -0800
From: "doni" <doni.sekar@gmail.com>
Subject: Re: Hash of Hashes
Message-Id: <1169832806.445118.272470@v45g2000cwv.googlegroups.com>

On Jan 26, 12:40 am, Josef Moellers
<josef.moell...@fujitsu-siemens.com> wrote:

> Beg your pardon?
> Why are you starting a new thread on almost the same subject as the old
> thread? Are you not satisfied with the answers that you get? Or is
> progress too slow and the deadline for your homework is nearing and you
> are desperate to get answers?

Since, my comments were not clear in my old thread, I rephrased my
question on this thread with more comments and what answer I was
expecting.
I am sorry if I am not supposed to open a new thread if I have stated
my question in an old thread.

Thanks,
doni



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

Date: 26 Jan 2007 09:57:10 -0800
From: "Brian McCauley" <nobull67@gmail.com>
Subject: Re: How can I convert a scalar to a range list ???
Message-Id: <1169834230.505029.234630@a75g2000cwd.googlegroups.com>

On Jan 26, 11:56 am, "Paul Lalli" <mri...@gmail.com> wrote:

[ speaking of eval ]

>     Use it
> if and ONLY if you are 100% sure you know the possible values this
> string can have.   (Consider for example, what would happen if the user
> did not enter "(1..10)", but instead "system('rm -rf /home/')" )

This advice always strikes me as flawed.

So long as you know the data is comming from the person as whom the
scipt is running the there's no problem. By "the person as whom the
scipt is running" I mean a person who can, by definition, perform any
action permitted to the current user ID.



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

Date: Fri, 26 Jan 2007 15:49:13 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: How can I convert a scalar to a range list ???
Message-Id: <g69veitms3a.fsf@dhcp-65-162.kendall.corp.akamai.com>

On 26 Jan 2007, nobull67@gmail.com wrote:

On Jan 26, 11:56 am, "Paul Lalli" <mri...@gmail.com> wrote:

> [ speaking of eval ]
>
>> Use it
>> if and ONLY if you are 100% sure you know the possible values this
>> string can have.  (Consider for example, what would happen if the user
>> did not enter "(1..10)", but instead "system('rm -rf /home/')" )
>
> This advice always strikes me as flawed.
>
> So long as you know the data is comming from the person as whom the
> scipt is running the there's no problem. By "the person as whom the
> scipt is running" I mean a person who can, by definition, perform any
> action permitted to the current user ID.

But how do you know this for sure?

What if the person was tricked into typing it in?

What if they used the wrong input file or typed the wrong command?

It's never a good idea to assume your users' input is the same as
their intentions.  It's an easy assumption, and certainly it makes
software simpler, but it complicates the users' lives.  Software is
supposed to work the other way.

I have the same problem with doing configuration files through "do
file.conf".  You just can't expect the system administrator to assume
the burden of securing your application's configuration, because in
principle they should.  In practice they won't.

Ted


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

Date: Sat, 27 Jan 2007 12:04:07 +1100
From: "Sisyphus" <sisyphus1@nomail.afraid.com>
Subject: Re: Net::FTPSSL problem (or how to do FTP over SSL another way?)
Message-Id: <45baa50d$0$9775$afc38c87@news.optusnet.com.au>


"DSIOMTW" <dsiomtw@gmail.com> wrote in message 
news:1169789225.933814.297610@m58g2000cwm.googlegroups.com...
> Hey Rob,
>
> Thanks a lot for your response. I was able to find the necessary patch
> and now it works like a champ!
>

Which patch was needed ? And where did you find it ? (The answers to those 
questions may be helpful to others.)

Cheers,
Rob 




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

Date: Fri, 26 Jan 2007 20:54:29 +0100
From: Martijn Lievaart <m@remove.this.part.rtij.nl>
Subject: Re: Removing HTML
Message-Id: <pan.2007.01.26.19.54.29.536722@remove.this.part.rtij.nl>

On Fri, 26 Jan 2007 03:45:04 -0800, Bill H wrote:

> Does anyone have an easy/fast way of removing HTML tags from a text
> file using perl? I am using the following brute force way of doing it,
> which does work, but can be a little slow:

An alternative to what the other posters said, but possibly even slower is
to use lynx with the --dump option.

HTH,
M4
-- 
Redundancy is a great way to introduce more single points of failure.



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

Date: Fri, 26 Jan 2007 17:57:07 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Sort on multiple values
Message-Id: <rfckr2drp945enr5alusn3rbs9due64pmn@4ax.com>

On Fri, 26 Jan 2007 14:25:00 +0100, Frank <ppi@searchy.net> wrote:

>> Incidentally, I also think you may want the underlined 1 above to be a
>> 2.
>
>Yup I did, typed too fast from the script I use it in. But that wasn't 
>really the problem because I've changed that part of the script several 
>times in attempt to let it work ;)

Well, that's the reason why people is generally recommended not to
retype code but to paste instead, anyway.


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: 26 Jan 2007 10:07:51 -0800
From: "doni" <doni.sekar@gmail.com>
Subject: Re: Statistics Extraction
Message-Id: <1169834871.609801.279910@p10g2000cwp.googlegroups.com>

On Jan 25, 2:42 pm, Eric Schwartz <emsch...@pobox.com> wrote:
> Can anyone let me know where I went wrong.It would help if you could include some data in the example, using the
> __DATA__ keyword.  And you could please let us know what it did, what
> you expected, and how they differ-- almost nobody is interested in figuring all that out for you.

Here is the data that I was using. I have attached 1 copy of MAC, PHY
and NETWORK Stats in here but in the file there will be atleast 10
copies of MAC, PHY and NETWORK Stats.

__DATA__

MAC statistics:
        0 frames with invalid header
        546 confirmed frames sent succesfully
        1693 confirmed frames sent unsuccesfully
        542 confirmed frames received
        4597 total frames received
        851 data packets received
        549 packets sent successfully
        152 packets sent unsuccessfully
        763 packets queued by network layer
        61 packet transmissions timed out
        0 packets with invalid length
        0 out of order fragments received
        87 duplicate fragments received
        0 partial packets received
        4 packet reassemblies timed out
        0 no buffers
PHY statistics:
        3404 frames transmitted
        105 transmits aborted due to rx
        0 transmit errors
        0 late transmits
        11 tx buffer loads interrupted
        0 tx buffer load failures
        4598 receive interrupts
        4598 frames received
        0 received frames lost
        0 zero length frames received
        0 receive cmd errors
Network statistics:
        851 total packets received
        0 bad packet length
        0 bad version number
        0 outgoing packets with no route
        0 input packets with bad destination address
        0 input packets from wrong channel
        0 packets dropped for exceeding TTL
        0 packets dropped due to full socket buffers
        0 packets dropped due to no receiver
        0 packets dropped due to running out of memory
        762 total packets sent
        549 packets succesfully transmitted
        213 packets sent unsuccessfully

> Let me please say again that the message in which you gave an example
> of your data is 8 messages before this one, and I just happened to get
> lucky that it was still on my newsserver.  If you want the most help
> possible, you really need to post, with your example code, an example
> of the data you're working on, what you get when you run your code on
> it, and what you expected, and how they are different.

I modified the code as per your suggestions but I am not sure whether I
modified it perfectly...

#! /usr/bin/perl

use warnings;
use strict;

my $ex_data = 'net.log';
open (NETSTAT,$ex_data) || die("Cannot Open File: $!");

my %stats = ();
my $message;

while (<NETSTAT>) {
        chomp;
        if (/^(\S+)\s+statistics:/)
        {
                $message = $1;
        }
        elsif (/^\s+(\d+)\s+(\S.*)/)
        {
                ($value, $key) = ($1, $2);
                if ($message =~ /mac/i) {
                        push @{$stats{mac}{$key}}, @value;
                }
                if ($message =~ /phy/i) {
                        push @{$stats{phy}{$key}}, @value;
                }
                if ($message =~ /network/i) {
                        push @{$stats{dli}{$key}}, @value;
                }
        }
        else
        { }
}

close(NETSTAT) || die("Cannot close $ex_data: $!");

foreach my $type (keys %stats) {
        print "$type stats:\n";

        foreach my $messages (keys %{$stats{$type}}) {
                print "\tmessages is: $messages\n";

                foreach my $val (@{$type{$messages}}) {
                        print "\t\tMessage value is: $val\n";
                }
        }
}


The output I got when I ran the code is:

network stats:
        messages is: packets dropped for exceeding TTL
        messages is: packets dropped due to running out of memory
        messages is: bad packet length
        messages is: packets dropped due to full socket buffers
        messages is: input packets from wrong channel
        messages is: input packets with bad destination address
        messages is: bad version number
        messages is: total packets received
        messages is: total packets sent
        messages is: packets succesfully transmitted
        messages is: packets dropped due to no receiver
        messages is: packets sent unsuccessfully
        messages is: outgoing packets with no route
phy stats:
        messages is: tx buffer load failures
        messages is: transmits aborted due to rx
        messages is: receive interrupts
        messages is: receive cmd errors
        messages is: frames received
        messages is: zero length frames received
        messages is: received frames lost
        messages is: late transmits
        messages is: frames transmitted
        messages is: transmit errors
        messages is: tx buffer loads interrupted
mac stats:
        messages is: packet transmissions timed out
        messages is: confirmed frames sent succesfully
        messages is: packet reassemblies timed out
        messages is: confirmed frames sent unsuccesfully
        messages is: duplicate fragments received
        messages is: total frames received
        messages is: packets sent successfully
        messages is: frames with invalid header
        messages is: data packets received
        messages is: no buffers
        messages is: packets sent unsuccessfully
        messages is: packets with invalid length
        messages is: packets queued by network layer
        messages is: out of order fragments received
        messages is: confirmed frames received
        messages is: partial packets received


I would also like all the $val part to be printed for each $messages
but there was none when I ran the code. Is there anything wrong with
the code below...

foreach my $type (keys %stats) {
        print "$type stats:\n";

        foreach my $messages (keys %{$stats{$type}}) {
                print "\tmessages is: $messages\n";

                foreach my $val (@{$type{$messages}}) {
                        print "\t\tMessage value is: $val\n";
                }
        }
}


Thanks,
doni



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

Date: Fri, 26 Jan 2007 23:44:01 +0100
From: Ch Lamprecht <ch.l.ngre@online.de>
Subject: Re: Statistics Extraction
Message-Id: <epe07f$okl$1@online.de>

doni wrote:

> Here is the data that I was using. I have attached 1 copy of MAC, PHY
> and NETWORK Stats in here but in the file there will be atleast 10
> copies of MAC, PHY and NETWORK Stats.

__DATA__ goes to the end of your code (see e.g. perldoc perldata)
> 
> __DATA__
> 
[DATA snipped]
> 

> I modified the code as per your suggestions but I am not sure whether I
> modified it perfectly...
> 
> #! /usr/bin/perl
> 
> use warnings;
> use strict;
The code you give does not run under use strict...
> 
> my $ex_data = 'net.log';
There is no need to open when using the DATA handle
> open (NETSTAT,$ex_data) || die("Cannot Open File: $!");
> 

[code snipped]

> I would also like all the $val part to be printed for each $messages
> but there was none when I ran the code. Is there anything wrong with
> the code below...
> 
> foreach my $type (keys %stats) {
>         print "$type stats:\n";
> 
>         foreach my $messages (keys %{$stats{$type}}) {
>                 print "\tmessages is: $messages\n";
> 
>                 foreach my $val (@{$type{$messages}}) {
        where does %type come from??? ^^^^^^
>                         print "\t\tMessage value is: $val\n";
>                 }
>         }
> }

HTH, Christoph




use warnings;
use strict;

my %stats = ();
my $message;

while (<DATA>) {
         chomp;
         if (/^(\S+)\s+statistics:/)
         {
                 $message = $1;
         }
         elsif (/^\s+(\d+)\s+(\S.*)/)
         {
                 my ($value, $key) = ($1, $2);
                 if ($message =~ /mac/i) {
                         push @{$stats{mac}{$key}}, $value;
                 }
                 if ($message =~ /phy/i) {
                         push @{$stats{phy}{$key}}, $value;
                 }
                 if ($message =~ /network/i) {
                         push @{$stats{dli}{$key}}, $value;
                 }
         }
         else
         { }
}


foreach my $type (keys %stats) {
         print "$type stats:\n";

         foreach my $messages (keys %{$stats{$type}}) {
                 print "\tmessages is: $messages\n";

                 foreach my $val (@{$stats{$type}{$messages}}) {
                         print "\t\tMessage value is: $val\n";
                 }
         }
}

__DATA__

MAC statistics:
         0 frames with invalid header
         546 confirmed frames sent succesfully
         1693 confirmed frames sent unsuccesfully
         542 confirmed frames received
         4597 total frames received
         851 data packets received
         549 packets sent successfully
         152 packets sent unsuccessfully
         763 packets queued by network layer
         61 packet transmissions timed out
         0 packets with invalid length
         0 out of order fragments received
         87 duplicate fragments received
         0 partial packets received
         4 packet reassemblies timed out
         0 no buffers
PHY statistics:
         3404 frames transmitted
         105 transmits aborted due to rx
         0 transmit errors
         0 late transmits
         11 tx buffer loads interrupted
         0 tx buffer load failures
         4598 receive interrupts
         4598 frames received
         0 received frames lost
         0 zero length frames received
         0 receive cmd errors
Network statistics:
         851 total packets received
         0 bad packet length
         0 bad version number
         0 outgoing packets with no route
         0 input packets with bad destination address
         0 input packets from wrong channel
         0 packets dropped for exceeding TTL
         0 packets dropped due to full socket buffers
         0 packets dropped due to no receiver
         0 packets dropped due to running out of memory
         762 total packets sent
         549 packets succesfully transmitted
         213 packets sent unsuccessfully




-- 
open($?,'>',$0);print$?join qq|\12\12|=>qw#;
print <<=><<=><<=><<=><<;
Just another Perl Hacker ;
# ;system "perl $0";


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

Date: 26 Jan 2007 15:35:20 -0800
From: "LtCommander" <LtCommander@gmail.com>
Subject: Re: String Substitution question
Message-Id: <1169854517.492287.206910@v45g2000cwv.googlegroups.com>

Thank you all for replying. This seems very basic yet I guess you miss
some things when you are self-taught.
Also, thanks for the pony + camel humor!!

Vince

On Jan 26, 11:51 am, "Mumia W. (NOSPAM)"
<paduille.4060.mumia.w+nos...@earthlink.net> wrote:
> On 01/25/2007 05:51 PM, LtCommander wrote:
>
>
>
> > This could be a stupid question but I am really stuck!
>
> > I am doing
> > $content=~ s/$m//sig;
>
> > The problem is that $m may have all sorts of escape sequence
> > characters, brackets and so on. So, sometimes, $content doesn't have
> > $match removed. So, I do this:
>
> >            $m =~ s/\(/\\(/sig;
> >            $m =~ s/\)/\\)/sig;
> >            $m =~ s/\[/\\[/sig;
> >            $m =~ s/\]/\\]/sig;
> >            $m =~ s/\?/\\?/sig;
> >            $m =~ s/\*/\\*/sig;
> >            $m =~ s/\./\\./sig;
> >            $m =~ s/\$/\\\$/sig;
> >            $m =~ s/\+/\\+/sig;
> >            $m =~ s/\_/\\_/sig;
> >            $m =~ s/\-/\\-/sig;
> > and then
> > $content=~ s/$m//sig;
>
> > Is there a better way of doing this?
>
> > Thanks a lot for any help.
>
> > VInceYes:
>
> $content =~ s/\Q$m\E//ig;
>
> Read the docs:
> perldoc perlre
> perldoc -f quotemeta
>
> --
> Windows Vista and your freedom in conflict:http://www.badvista.org/



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

Date: 26 Jan 2007 13:10:36 -0800
From: mailbox@cpacker.org
Subject: Using Expect to spawn an interactive tool
Message-Id: <1169845836.324830.61100@v45g2000cwv.googlegroups.com>

I need to run a full-screen interactive database access program.
But invoking it involves responding to prompts for database name,
user and password before I can key in database queries. I'm
wondering if Expect would be appropriate for automating the
invocation sequence and then passing control to my fingers.
My limited experience with Expect has been to use it for short
interactions with the operating system that aren't open-ended
like that.

--
Charles Packer
mailboxATcpacker.org



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

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 V11 Issue 80
*************************************


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