[19210] in Perl-Users-Digest
Perl-Users Digest, Issue: 1405 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 30 11:06:16 2001
Date: Mon, 30 Jul 2001 08: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)
Message-Id: <996505512-v10-i1405@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 30 Jul 2001 Volume: 10 Number: 1405
Today's topics:
Annoying emacs cperl mode error <kj0@mailcity.com>
calling a perl script from perl (M)
Re: calling a perl script from perl <ilya@martynov.org>
Re: chess in perl <m.grimshaw@salford.ac.uk>
Re: counting <godzilla@stomp.stomp.tokyo>
Re: counting <godzilla@stomp.stomp.tokyo>
creat mailboxes <eliash@aon.at>
Re: creat mailboxes <carlos@plant.student.utwente.nl>
FAQ: How do I extract selected columns from a string? <faq@denver.pm.org>
Re: Finding keywords in text files (Yves Orton)
Graphics modules <u9jdf@csc.liv.ac.uk>
Re: Graphics modules <Tassilo.Parseval@post.rwth-aachen.de>
Re: Graphics modules <bart.lateur@skynet.be>
Re: Graphics modules <flavell@mail.cern.ch>
Re: Graphics modules (Randal L. Schwartz)
Re: How can I download a file and stroke a counter at t <nospammers@springmail.com>
Re: Informix IDS2000 and Zope/Python/Perl/PHP on Linux <soerense@verwaltung.uni-mainz.de>
Re: Is a function/class library for processing of SMTP- (Cameron Laird)
Re: Mail::Internet not the right choice for me ? <tag@gmx.de>
negative lookahead (mike)
Re: negative lookahead <bart.lateur@skynet.be>
newbe question splitting a string into two different va <none@nowere.com>
Re: newbe question splitting a string into two differen <carlos@plant.student.utwente.nl>
Re: newbe question splitting a string into two differen <none@nowere.com>
Re: newbe question splitting a string into two differen <Svein.Seldal@q-free.com>
Re: newbe question splitting a string into two differen <none@nowere.com>
Re: newbe question splitting a string into two differen <none@nowere.com>
Re: newbe question splitting a string into two differen <Tassilo.Parseval@post.rwth-aachen.de>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 30 Jul 2001 08:20:47 -0400
From: kj0 <kj0@mailcity.com>
Subject: Annoying emacs cperl mode error
Message-Id: <9k3jev$qa2$1@panix3.panix.com>
In my_script.pl, emacs' cperl mode fails to fontify all the text after
the line:
my $pat = qr/<[^<]*?>/;
If I hit M-g M-g, I get the error message:
Fontifying my_script.pl... (regexps................)
End of `qr/ ... /' string/RE not found: (scan-error Unbalanced parentheses 2263 7191)
How can I fix this problem?
(I'm using emacs 20.5.1)
Thanks,
KJ
------------------------------
Date: Mon, 30 Jul 2001 11:11:22 GMT
From: lithotroph@hotmail.com (M)
Subject: calling a perl script from perl
Message-Id: <90EE8B796pr5j8k@24.132.65.8>
Hello,
A probably stupid question: Can someone inform me on how to call a
perl script from a current perl script while terminating the later
(removing it from the stack) at the same time?
Thanks.
------------------------------
Date: 30 Jul 2001 15:59:55 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: calling a perl script from perl
Message-Id: <87n15mbpac.fsf@abra.ru>
M> Hello,
M> A probably stupid question: Can someone inform me on how to call a
M> perl script from a current perl script while terminating the later
M> (removing it from the stack) at the same time?
exec("myscript.pl")
Read 'perldoc -tf exec' for more info.
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/) |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80 E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/) |
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
------------------------------
Date: Mon, 30 Jul 2001 12:16:09 +0100
From: Mark Grimshaw <m.grimshaw@salford.ac.uk>
Subject: Re: chess in perl
Message-Id: <3B6541F9.33A31221@salford.ac.uk>
Malte Ubl wrote:
>
> Sean Mintz schrieb:
> >
> > Hi,
> > Any ideas you may have to speeding this up in any area would be
> > greatly appreciated. If you have any interest in actually working on
> > this with me, that would be even better.
>
> Well,
>
> you can probably find complete chess playing algorithms somewhere on
> the internet. Just implement them in Perl and your done. Good techniques
> to improve your algorithm performance are writenn down in "Mastering
> Algorithms in Perl".
>
> If thats still too slow you might want to write the whole thing in C or
> consider using Inline for the number crunching parts.
>
> ->malte
I could be totally wrong here but I always thought that using references
to hashes between subroutines (as opposed to just passing and returning
the hashes as you're doing) would be quicker and more memory efficient
especially if the hashes are large.
------------------------------
Date: Mon, 30 Jul 2001 07:22:45 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: counting
Message-Id: <3B656DB5.E41B5CF@stomp.stomp.tokyo>
Michael Budash AKA The CLPM Troll wrote:
> Godzilla! wrote:
> > jtjohnston wrote:
(snipped)
> Michael Budash ~~~~~~~~~~ mbudash@sonic.net
Yours is a piss poor troll article riddled with
lies and blatant stupidity, as usual.
Godzilla!
------------------------------
Date: Mon, 30 Jul 2001 07:24:30 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: counting
Message-Id: <3B656E1E.799E5FEC@stomp.stomp.tokyo>
Chris Micallef AKA The CLPM Troll wrote:
(snipped)
> Give it a break!
Get a brain.
Godzilla!
------------------------------
Date: Mon, 30 Jul 2001 12:42:22 +0200
From: "Elias" <eliash@aon.at>
Subject: creat mailboxes
Message-Id: <3b65395c$0$9436$6e365a64@newsreader02.highway.telekom.at>
i want to write a perl-script, that creates new mailboxes on my server
(www.elias-web.com/hallerjugend) when someone register on this site!
i heared Net::IMAPClient can create mailboxes, but i don't know what i've to
take as server or username or password ...
my webprovider sent me the following:
FTP: IP, name, password
POP3: IP
SMTP: IP, name, password
please help me !! :)
------------------------------
Date: Mon, 30 Jul 2001 14:04:35 +0200
From: "carlos" <carlos@plant.student.utwente.nl>
Subject: Re: creat mailboxes
Message-Id: <9k3igk$eju$1@dinkel.civ.utwente.nl>
"Elias" <eliash@aon.at> wrote in message
news:3b65395c$0$9436$6e365a64@newsreader02.highway.telekom.at...
> i want to write a perl-script, that creates new mailboxes on my server
> (www.elias-web.com/hallerjugend) when someone register on this site!
>
> i heared Net::IMAPClient can create mailboxes, but i don't know what i've
to
> take as server or username or password ...
> my webprovider sent me the following:
>
> FTP: IP, name, password
> POP3: IP
> SMTP: IP, name, password
>
> please help me !! :)
>
ok, please post your passwords here, we will decide which one you should use
for IMAP.
------------------------------
Date: Mon, 30 Jul 2001 12:19:05 GMT
From: PerlFAQ Server <faq@denver.pm.org>
Subject: FAQ: How do I extract selected columns from a string?
Message-Id: <Zgc97.161$os9.199699456@news.frii.net>
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 every Standard Distribution of
Perl.
+
How do I extract selected columns from a string?
Use substr() or unpack(), both documented in the perlfunc manpage. If
you prefer thinking in terms of columns instead of widths, you can use
this kind of thing:
# determine the unpack format needed to split Linux ps output
# arguments are cut columns
my $fmt = cut2fmt(8, 14, 20, 26, 30, 34, 41, 47, 59, 63, 67, 72);
sub cut2fmt {
my(@positions) = @_;
my $template = '';
my $lastpos = 1;
for my $place (@positions) {
$template .= "A" . ($place - $lastpos) . " ";
$lastpos = $place;
}
$template .= "A*";
return $template;
}
-
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.
Answers to questions about LOTS of stuff, mostly not related to
Perl, can be found by pointing your news client to
news:news.answers
or to the many thousands of other useful Usenet news groups.
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-1999 Tom Christiansen and Nathan
Torkington. 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.
04.32
--
This space intentionally left blank
------------------------------
Date: 30 Jul 2001 07:12:11 -0700
From: demerphq@hotmail.com (Yves Orton)
Subject: Re: Finding keywords in text files
Message-Id: <74f348f7.0107300612.1550c901@posting.google.com>
Benjamin Goldberg <goldbb2@earthlink.net> wrote in message news:<3B64E3CF.3BD8E25@earthlink.net>...
> delete @counts{qw(a is or of it the and)}; # delete "stopwords"
Cool. Never thought of using delete with array slices.
Nice trick.
Yves
------------------------------
Date: Mon, 30 Jul 2001 11:09:39 GMT
From: "J.D. Fieldsend" <u9jdf@csc.liv.ac.uk>
Subject: Graphics modules
Message-Id: <3B654073.BC5C99D5@csc.liv.ac.uk>
I am using the GD::Graph perl modules to create graph in a PNG format.
At the moment the script will output the graph to a PNG file on my hard
disc. I am then calling the image using HTML tags.
The problem is that when the graph is output to disc and is called
straight away the graph that is being retrieved is not the most up to
date graph.
Is there any way of outputting the graph straight to the web browser
without saving it to disc?
------------------------------
Date: Mon, 30 Jul 2001 13:57:06 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: Graphics modules
Message-Id: <3B654B92.5000602@post.rwth-aachen.de>
J.D. Fieldsend wrote:
>I am using the GD::Graph perl modules to create graph in a PNG format.
>At the moment the script will output the graph to a PNG file on my hard
>disc. I am then calling the image using HTML tags.
>
>The problem is that when the graph is output to disc and is called
>straight away the graph that is being retrieved is not the most up to
>date graph.
>
>Is there any way of outputting the graph straight to the web browser
>without saving it to disc?
>
Yes, probably.
my $graphic = function_that_creates_graphic;
print "Content-type: image/png\n\n";
binmode STDOUT;
print $graphic;
This works assuming your script is called via CGI by a webbrowser.
Regards,
Tassilo
--
If rabbits' feet are so lucky, what happened to the rabbit?
------------------------------
Date: Mon, 30 Jul 2001 13:10:42 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Graphics modules
Message-Id: <d0namtcbageta6brofkg4iuee2c2f0f183@4ax.com>
J.D. Fieldsend wrote:
>I am using the GD::Graph perl modules to create graph in a PNG format.
>At the moment the script will output the graph to a PNG file on my hard
>disc. I am then calling the image using HTML tags.
>
>The problem is that when the graph is output to disc and is called
>straight away the graph that is being retrieved is not the most up to
>date graph.
Indeed. Your problem is caching of the (old) document by the web server.
>Is there any way of outputting the graph straight to the web browser
>without saving it to disc?
Print an appropriate content-type header, a blank line, do
binmode(STDOUT), and then print your image data to STDOUT:
print $GD->png;
(according to the GD docs).
--
Bart.
------------------------------
Date: Mon, 30 Jul 2001 15:45:37 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Graphics modules
Message-Id: <Pine.LNX.4.30.0107301524110.18782-100000@lxplus023.cern.ch>
On Jul 30, J.D. Fieldsend delicately tapped the keys:
> I am using the GD::Graph perl modules to create graph in a PNG format.
> At the moment the script will output the graph to a PNG file on my hard
> disc. I am then calling the image using HTML tags.
This isn't really a Perl question; it would be more at home in the
comp.infosystems.www.authoring.cgi group (although its automoderation
bot seems to have been playing silly b*ggers recently).
You really would be better advised not to introduce the complication
of intermediate disk files, and all that it implies, unless you have a
damned good reason for doing so, and understand how to cope with the
resultant housekeeping. The classic approach, instead of that, is a
two-phase operation, first an HTML-generating script is called and
generates an HTML document, which contains an IMG tag whose SRC cites
a call to an image-generating script.
Shortly thereafter, but asynchronously, you expect the client to
action the IMG and call the image-generating script. At that time you
have the script return the image document (it's good practice to set
binmode() for that, albeit on unix platforms it'll be a no-op).
For convenience, one usually writes a dual-purpose script, which gets
called in two different modes - its HTML-generating mode, then its
image-generating mode. But you have to keep in mind that the two
calls are independent and asynchronous.
In each phase, don't forget you have to start by emitting the
appropriate Content-type: header (text/html or image/png as the case
may be) and double newline. (CGI.pm has methods to do that nicely).
Any data which you need to pass beween the HTML generating mode and
the image generating mode can be put into hidden input fields (again,
CGI.pm does this for you nicely).
Remember these calls are asynchronous and there could be several of
them running concurrently, so it's a no-no to try to write
intermediate results from the first phase into a fixed location on the
server in the hope that the second phase will find them.
HTH
------------------------------
Date: 30 Jul 2001 07:59:02 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Graphics modules
Message-Id: <m11ymy79ah.fsf@halfdome.holdit.com>
>>>>> "Alan" == Alan J Flavell <flavell@mail.cern.ch> writes:
Alan> For convenience, one usually writes a dual-purpose script, which gets
Alan> called in two different modes - its HTML-generating mode, then its
Alan> image-generating mode. But you have to keep in mind that the two
Alan> calls are independent and asynchronous.
Very much like I've done at
<http://www.stonehenge.com/merlyn/WebTechniques/col60.html>
which you can use as a complete working example.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Mon, 30 Jul 2001 14:32:41 GMT
From: "brian miller" <nospammers@springmail.com>
Subject: Re: How can I download a file and stroke a counter at the same time?
Message-Id: <dee97.1619$xA3.906371@typhoon.jacksonville.mediaone.net>
Build a cgi wrapper and do both things from one script?
"Tony Essman" <tonyessman@hotmail.com> wrote in message
news:1da16a12.0107291315.34ea486e@posting.google.com...
> Hi all,
>
> My appologies in advance if this is the wrong group
> for this post. Please redirect me if so. I searched
> usenet for a web-programming group and this seems to
> be as close as I could get. I believe it would not be
> far wrong to say most Perl programmers know or thing
> or three about web programming. This post tests my
> assumption.
>
> I'm writing a web page which offers a download. I
> want to download the file and stroke a counter on the
> server when the user clicks on the download file
> link. Nobody gets tracked -- I just want to know how
> many actual downloads were performed.
>
> I know how to download the file with href="ftp://..."
> etc., and I know how to stroke a counter on the host
> with a cgi-bin perl script. What I can't figure out
> is how to do both with just the one click on the
> download file link. Maybe that's not possible.
>
> Any help or a point in the right direction is appreciated.
>
> Tony.
------------------------------
Date: 30 Jul 2001 15:17:03 +0200
From: Ruediger Soerensen <soerense@verwaltung.uni-mainz.de>
Subject: Re: Informix IDS2000 and Zope/Python/Perl/PHP on Linux
Message-Id: <ytwpuaisgj4.fsf@jorge.verwaltung.uni-mainz.de>
Thomas Volkmar Worm <worm@gdp-group.com> writes:
> Hi all!
>
> I am consindering to use Informix Dynamic Server (Informix Internet
> Foundation 2000/Linux) together with Zope and the other 3 P's.
>
> I wonder, whether somebody has any experience with Linux and
>
> - IDS 2000 and Perl
> or
> - IDS 2000 and PHP
> or
> - IDS 2000 and Python
> or
> - IDS 2000 and Zope
We use Zope, Perl and Python with IDS2000 on Linux and
Solaris. Personally, I prefer Python over Perl. I use informixdb-1.3
with two or three small patches addressing some problems with stored procedures
and data manipulation statements as well as DATE problems. My Zope-Database-Adapter is also
based on informixdb-1.3.
Currently we are developing a SOAP-based client/server system with
INFORMIX as DB-backend and Windows-clients using COM for delivering
the SELECTed data into Excel. All in python, works like a charm.
I really recommend using python in database applications.
>
> and can tell me about the experience he made with one or more of these
> combinations. I am interested to hear about
>
> - availibility of the needed drivers
> - their (practical) compatibility to (eg. perl DBI, python DB-API 2.0,
> etc.)
> - stability
> - and what else someone has experienced
>
> I already was an php.net, python.org, perl.org, zope.org - I guess I
> know whats available. It looks to me as if the support for IDS is not so
> strong, so I am really interested in real experience somebody had rather
> that what you can read in the READMEs. If you stopped using IDS together
> with P..., please tell me why and what db (other than mySQL, thats
> allready running here) are you using instead.
>
> If some Informix/IBM people are around: Are there any contributions
> planned or in progress for the 3 P's by Informix/IBM? Where can I find
> online information about it?
>
Well, this information would be welcome here, too.
--
Rüdiger Sörensen || soerense@verwaltung.uni-mainz.de
------------------------------
Date: 30 Jul 2001 06:56:52 -0500
From: claird@starbase.neosoft.com (Cameron Laird)
Subject: Re: Is a function/class library for processing of SMTP-mails available?
Message-Id: <EBCF5DA748D324C8.E0FAD273B2AA6AD1.9ABE76755D19CF27@lp.airnews.net>
In article <3B651E12.A08F2FB2@iit.demokritos.gr>,
Petasis George <petasis@iit.demokritos.gr> wrote:
>Markus Elfring wrote:
>>
>> I have found a useful module
>> (http://search.cpan.org/search?module=Mail::Audit,
>> http://simon-cozens.org/writings/mail-audit.html) for Perl now.
>> Does anybody know a similar library for other programming languages?
>
>There is an smtp & mime package in tcllib 0.8. You can try that...
>
>George
And in fact most languages you're likely to use have such
packages. I've found simple searches--even simpler than
asking in comp.lang.*!--generally find them quickly. Is
there one in particular perplexing you?
--
Cameron Laird <claird@NeoSoft.com>
Business: http://www.Phaseit.net
Personal: http://starbase.neosoft.com/~claird/home.html
------------------------------
Date: Mon, 30 Jul 2001 12:51:01 +0200
From: Toni Duago <tag@gmx.de>
Subject: Re: Mail::Internet not the right choice for me ?
Message-Id: <3B653C15.99BAF494@gmx.de>
> > $message_obj->body() gives me just a array of all the
> > headers PLUS the message
>
> No it doesn't...I just sent myself an email and used this
> program to read it from standard input.
Okay, you are right. Somehow I managed to f***up the format
of my mbox. Thank you for your advice !
Y.T.,
Toni.
------------------------------
Date: 30 Jul 2001 06:11:19 -0700
From: rafalam@cadmus.com (mike)
Subject: negative lookahead
Message-Id: <bcffa3aa.0107300511.7dadb4b8@posting.google.com>
Task:
I want to match a string that starts with "aaa" and ends with "bbb" as
long as the is no "zzz" between aaa and bbb.
My attempt:
$mystring =~ m/aaa.*?(?!zzz)bbb/si;
Result:
Still matches even if the string contains zzz.
I'd expect the .*? to fail as soon as it hits the zzz?
How would I achieve my goal?
------------------------------
Date: Mon, 30 Jul 2001 13:26:16 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: negative lookahead
Message-Id: <g5oamtslgdf1p85bhhuo41a3cj1g51vvsv@4ax.com>
mike wrote:
>I want to match a string that starts with "aaa" and ends with "bbb" as
>long as the is no "zzz" between aaa and bbb.
>
>My attempt:
>
>$mystring =~ m/aaa.*?(?!zzz)bbb/si;
>
>Result:
>
>Still matches even if the string contains zzz.
I think this will work:
m/aaa(?:(?!zzz).)*?bbb/si;
but it probably won't be the fastest scheme imaginable.
--
Bart.
------------------------------
Date: Mon, 30 Jul 2001 14:41:55 +0100
From: fred58 <none@nowere.com>
Subject: newbe question splitting a string into two different variables
Message-Id: <3roamt4jqf75g3ierd9qic6d8m8ar42dvj@4ax.com>
Right here is my problem i would like to split this string at the |
"hello | good buy" into two different variables but im unsure of the
best way to do this any help would be gratefully received
Thanks
------------------------------
Date: Mon, 30 Jul 2001 15:48:12 +0200
From: "carlos" <carlos@plant.student.utwente.nl>
Subject: Re: newbe question splitting a string into two different variables
Message-Id: <9k3oit$ifu$1@dinkel.civ.utwente.nl>
`perldoc -f split`
RTFM
"fred58" <none@nowere.com> wrote in message
news:3roamt4jqf75g3ierd9qic6d8m8ar42dvj@4ax.com...
> Right here is my problem i would like to split this string at the |
> "hello | good buy" into two different variables but im unsure of the
> best way to do this any help would be gratefully received
>
> Thanks
>
------------------------------
Date: Mon, 30 Jul 2001 14:58:59 +0100
From: fred58 <none@nowere.com>
Subject: Re: newbe question splitting a string into two different variables
Message-Id: <erpamtsqj724pqc9tn28ssmmndev89fdh9@4ax.com>
Yes i already looked at this thanks, any chance of the a simpler
explanation for us idiots just learning perl well trying to and the
perldocs read rather like Japanese stereo instructions to me.
Thanks for the help
On Mon, 30 Jul 2001 15:48:12 +0200, "carlos"
<carlos@plant.student.utwente.nl> wrote:
>`perldoc -f split`
>
>RTFM
>"fred58" <none@nowere.com> wrote in message
>news:3roamt4jqf75g3ierd9qic6d8m8ar42dvj@4ax.com...
>> Right here is my problem i would like to split this string at the |
>> "hello | good buy" into two different variables but im unsure of the
>> best way to do this any help would be gratefully received
>>
>> Thanks
>>
>
------------------------------
Date: Mon, 30 Jul 2001 16:20:52 +0200
From: "Svein Erling Seldal" <Svein.Seldal@q-free.com>
Subject: Re: newbe question splitting a string into two different variables
Message-Id: <t6e97.2058$e%4.53497@news3.oke.nextra.no>
my @list = split( /\|/,$input);
Access them by $list[0], $list[1], etc.
Svein Erling Seldal
"fred58" <none@nowere.com> wrote in message
news:3roamt4jqf75g3ierd9qic6d8m8ar42dvj@4ax.com...
> Right here is my problem i would like to split this string at the |
> "hello | good buy" into two different variables but im unsure of the
> best way to do this any help would be gratefully received
>
> Thanks
>
------------------------------
Date: Mon, 30 Jul 2001 15:44:43 +0100
From: fred58 <none@nowere.com>
Subject: Re: newbe question splitting a string into two different variables
Message-Id: <ocsamtkbcmndon325952vtn4f2a22o3cmm@4ax.com>
On Mon, 30 Jul 2001 16:20:52 +0200, "Svein Erling Seldal"
<Svein.Seldal@q-free.com> wrote:
>my @list = split( /\|/,$input);
>
>Access them by $list[0], $list[1], etc.
>
>
>Svein Erling Seldal
ok i think you turned over two pages at once for me there i understand
how the split works now so thanks for that and i understand how to
access the split list as individual variables what i don't understand
is how to split my string
$vara = "hello | goodbuy";
now i have the string to be split but how do i get my string into a
scalar variable ie @list to split it into its individual parts
sorry very new at this probable obvious to most ppl here
Thanks
------------------------------
Date: Mon, 30 Jul 2001 15:56:03 +0100
From: fred58 <none@nowere.com>
Subject: Re: newbe question splitting a string into two different variables
Message-Id: <f7tamts3s2nu00jct7mefemfjtgnlvtf6e@4ax.com>
opps worked it out bloody obvious after a couple of mins thought
thanks for all your help.
$dave = "dave | hello";
my @list = split( /\|/,$dave);
print "$list[0]";
print "\n";
print "$list[1]";
Thanks again simple when you know how but iv been trying to work the
dam thing out for about four hours now so your help really was
appreciated .
------------------------------
Date: Mon, 30 Jul 2001 17:01:24 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: newbe question splitting a string into two different variables
Message-Id: <3B6576C4.7060209@post.rwth-aachen.de>
fred58 wrote:
>ok i think you turned over two pages at once for me there i understand
>how the split works now so thanks for that and i understand how to
>access the split list as individual variables what i don't understand
>is how to split my string
>
>$vara = "hello | goodbuy";
>
If your string is really "hello | goodbuy", then the following will do:
($first_part, $second_part) = split /\s+\|\s+/, $vara;
which will assign $first_part = "hello" and $second_part = "goodbuy". It
splits on '|' with an arbitrary number of whitespaces before and/or
behind the pipe.
The above construction is called an anonymous array. It is the same as:
@array = split /\s+\|\s+/, $vara;
$first_part = $array[0];
$second_part = $array[1];
Tassilo
--
Interestingly enough, since subroutine declarations can come anywhere,
you wouldn't have to put BEGIN {} at the beginning, nor END {} at the
end. Interesting, no? I wonder if Henry would like it. :-) --lwall
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 1405
***************************************