[15728] in Perl-Users-Digest
Perl-Users Digest, Issue: 3141 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 23 21:05:34 2000
Date: Tue, 23 May 2000 18:05:18 -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: <959130317-v9-i3141@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 23 May 2000 Volume: 9 Number: 3141
Today's topics:
Re: $ENV{'REMOTE_USER'}; <tony_curtis32@yahoo.com>
Re: ??? help! referrer url should be ...... (David Efflandt)
[Help] Processing a REQUEST, then redirect via a POST m <oozi@yahoo.com>
Re: [Help] Processing a REQUEST, then redirect via a PO <makarand_kulkarni@My-Deja.com>
Re: About "sprint f" ? (Bart Lateur)
Re: Accounting Systems Written In Perl??? <makarand_kulkarni@My-Deja.com>
Re: Accounting Systems Written In Perl??? neil@pacifier.com
Announce: Solaris::ACL 0.06 (Ian B. Robertson)
array within array revisited j555@my-deja.com
Re: array within array revisited <makarand_kulkarni@My-Deja.com>
Re: array within array revisited (Steven Smolinski)
Re: Basic Script needed <rootbeer@redcat.com>
Re: Basic scripting question (Bart Lateur)
bug with 5.004_04? <jim3@psynet.net>
Cookies for a newbie <passagewd@primus.ca>
Re: Cookies for a newbie <makarand_kulkarni@My-Deja.com>
Exec() returned - Script exection Error <passagewd@primus.ca>
Re: Exec() returned - Script exection Error <tony_curtis32@yahoo.com>
Re: Exec() returned - Script exection Error <passagewd@primus.ca>
Re: Exec() returned - Script exection Error (Abigail)
Re: Exec() returned - Script exection Error (Abigail)
Re: Exec() returned - Script exection Error <passagewd@primus.ca>
Re: Exec() returned - Script exection Error (David Efflandt)
Re: Exec() returned - Script exection Error (Bart Lateur)
Re: file locking (Bart Lateur)
Re: How do I extract 2nd and 3rd characters from a stri (Gwyn Judd)
Re: How do I extract 2nd and 3rd characters from a stri <rootbeer@redcat.com>
Re: How do I extract 2nd and 3rd characters from a stri <lr@hpl.hp.com>
Re: Including variables defined outside the script <isd@mail.as.uaf.edu>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 23 May 2000 18:13:19 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: $ENV{'REMOTE_USER'};
Message-Id: <87d7mcoo6o.fsf@limey.hpcc.uh.edu>
>> On Tue, 23 May 2000 15:22:20 GMT,
>> "John Lawson" <John@expresspayments.com> said:
> I am still having some problem. After i login i run a
> script form the cgi-bin and the $ENV{'REMOTE_USER'} has
> no value set to it. do i have to login to the cgi-bin or
> am i calling it wrong. Here is a complete summary. I
> have a htacess protected directory in the main
> directory. after they login to that directory i call a
> script and want to know who logged in. i set
> $user=$ENV{'REMOTE_USER'}; when i print out $user there
> is no value i am not sure if it is because i have to
> login to the cgi-bin or if i am calling the env wrong.
It sounds like the program in the cgi-bin is not within
the protected realm (and thus no authentication
information is being passed), however that is an issue for
configuration within your web server.
hth
t
------------------------------
Date: 24 May 2000 00:40:54 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: ??? help! referrer url should be ......
Message-Id: <slrn8im98l.4h6.efflandt@efflandt.xnet.com>
On 23 May 2000 07:11:50 +0100, Jonathan Stowe <gellyfish@gellyfish.com> wrote:
>On Sun, 21 May 2000 15:31:26 -0700 John Springer wrote:
>> in article 8g9bin$krk$1@nnrp1.deja.com, swapnil909@my-deja.com at
>> swapnil909@my-deja.com wrote on 5/21/00 11:57 AM:
>>
>>> BUT I WANT THAT THE REFERRER THAT VALUECLIK.COM RECIEVES IS MYSITE.COM
>>> AND NOT MYCLIENTS.COM
>>>
>>> could somebody please help what should i do????
>>> all programs are done in perl.
>>> i have tried quite a few redirection scripts, but none seems to work.
>>>
>> The HTTP_REFERER comes from the browser, so there is little you can do about
>> it directly. The only thing I can see is if the ad on the page is pointing
>> to say http://valueckick.com/gobble/gobble, you could instead point it to a
>> script on your own site. Then the script goes to valueclick, gets the
>> graphic, and delivers it to the client, along with the right click-through
>> URLs. You would have to look like a browser going to valueclick to get the
>> client, which you could do with the NET:: libraries and probably some other
>> stuff that emulates a browser. It's not too hard if you just open a telnet
>> connection on port 80 and send all the headers a browser would send.
>>
>
>I dont see any reason to go to the effort of reinventing an HTTP client when
>the LWP::UserAgent would make this so much easier :
Just one problem with any attempt with a script as a middleman. If credit
is based on access by unique hosts, these would all appear to come from
the same host and valueclick would not be able to tell if they were legit
or if he was just trying to pad his account. And it does appear that he
is trying to get credit for banner ads shown by others.
However, if value click had an ID in the link to identify who should get
credit, then it would not matter that some of them come from myclients.com
instead of mysite.com. I wonder what he is paying those people to carry
these ads for him and how he determines what the payment should be?
--
David Efflandt efflandt@xnet.com http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/ http://cgi-help.virtualave.net/
------------------------------
Date: Tue, 23 May 2000 23:49:18 GMT
From: David Potosky <oozi@yahoo.com>
Subject: [Help] Processing a REQUEST, then redirect via a POST method
Message-Id: <8gf5dq$8qi$1@nnrp1.deja.com>
Hi,
A few weeks ago I was working with PERL, and we tried to do some text
processing on a HTML request, then redirect the extracted/processed
text to another URL via a POST.
We were unsuccessful, and as far as I could determine it in fact
couldn't be done. I couldn't send it through a GET method (too big) or
store it in a cookie (apparently Netscape standard is 2k - data is too
big again).
Could it have been done, and I was missing something? If not, is there
another way to do it?
We solved the problem doing something else, but my curiousity has got
the best of me (I am a Java programmer - not a PERL expert) and I
wanted to know how I could do it.
Thanks in advance,
David
--
David Potosky oozi@yahoo.com
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 23 May 2000 17:03:35 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: [Help] Processing a REQUEST, then redirect via a POST method
Message-Id: <392B1C57.635DFAF5@My-Deja.com>
> Could it have been done, and I was missing something? If not, is there
> another way to do it?
Did you use the modules LWP::UserAgent and HTTP::Request::Common ?
They are your friends. If you did use them and still failed then show us
some
code.
--
------------------------------
Date: Wed, 24 May 2000 00:06:29 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: About "sprint f" ?
Message-Id: <392c1cab.494379@news.skynet.be>
Gary E. Ansok wrote:
>>2. If the $basevalue is longer than 30 characters,
>>How can I cut off the letters at 30 ?
>
>You can use substr(), or it sounds like this will work to do both
>padding and truncating in one call:
>
>$value_with_pad = sprintf("%-30.30s", $basevalue);
Or pack.
$value_with_pad = pack 'A30', $basevalue;
Left aligned, always 30 characters, padded with spaces.
--
Bart.
------------------------------
Date: Tue, 23 May 2000 15:33:05 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: Accounting Systems Written In Perl???
Message-Id: <392B0721.641F98B4@My-Deja.com>
> Does anyone know if there are any decent accounting systems written in perl
Accounting of what?
Financial acconting or network traffic accounting or something else.
--
------------------------------
Date: 23 May 2000 16:26:28 PST
From: neil@pacifier.com
Subject: Re: Accounting Systems Written In Perl???
Message-Id: <392b13a4.0@news.pacifier.com>
otrcomm**NO_SPAM**@wildapache.net wrote:
> Hello,
> Does anyone know if there are any decent accounting systems written in perl
> that will run on a Linux system?
I think what you are really looking for is an accounting system that will
run on Linux, not specifically that it has to be written in Perl. Try one
of the linux groups such as comp.os.linux.misc.
--
Neil
------------------------------
Date: 23 May 2000 17:15:56 -0500
From: ian@lugh.uchicago.edu (Ian B. Robertson)
Subject: Announce: Solaris::ACL 0.06
Message-Id: <iuDW4.41608$g41.1835279@news-west.usenetserver.com>
I am happy to announce the release of Solaris::ACL, version 0.06.
This module allows perl programmers to directly access Access Control
Lists for Solaris file systems without execing calls to getfacl and
setfacl. This is the first public release; please email
iroberts@cpan.org with comments, suggestions, bug-reports, etc...
- Ian Robertson
System Programmer
Network Security and Enterprise Network Server Administration
ian@lugh.uchicago.edu
------------------------------
Date: Tue, 23 May 2000 23:36:31 GMT
From: j555@my-deja.com
Subject: array within array revisited
Message-Id: <8gf4lu$8cg$1@nnrp1.deja.com>
Hi,
I know people have asked about putting arrays within
arrays before, and I know there is SUPPOSED TO BE
an actual answer in the FAQ answer list. But the thing is,
the answer is pretty limited and doesn't answer my question.
My question is, why does this not print out 3 and 3?
@a = (1,2,3);
@b = (4,5,[@a]);
@c = @b[2]; # should be same as @a
$d = @b[2]; # should be even more reliable
print $#c + 1; # number of elements in @c should be 3
print $#d + 1; # should also be three
# This prints out 1 and 1.
Thanks for any info.
j555
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 23 May 2000 17:11:38 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: array within array revisited
Message-Id: <392B1E3A.B371F8F3@My-Deja.com>
> @a = (1,2,3);
> @b = (4,5,[@a]);
> @c = @b[2]; # should be same as @a
Now c is an array with a single element which is a ref to a.
> $d = @b[2]; # should be even more reliable
> print $#c + 1; # number of elements in @c should be 3
$#c has a single element. Hence 1 as answer.
> print $#d + 1; # should also be three
@d does not exist. Hence $#d will be zero.
------------------------------
Date: Wed, 24 May 2000 00:12:20 GMT
From: sjs@yorku.ca (Steven Smolinski)
Subject: Re: array within array revisited
Message-Id: <slrn8im7ef.5uu.sjs@john.sympatico.ca>
On Tue, 23 May 2000, j555@my-deja.com <j555@my-deja.com> wrote:
>I know people have asked about putting arrays within
>arrays before, and I know there is SUPPOSED TO BE
>an actual answer in the FAQ answer list. But the thing is,
>the answer is pretty limited and doesn't answer my question.
perldoc perlref
>My question is, why does this not print out 3 and 3?
This has lots of errors: make sure to use -w and 'use strict;'.
>@a = (1,2,3);
>@b = (4,5,[@a]);
The [] makes the third element of @b a reference to an array,
not an array.
>@c = @b[2]; # should be same as @a
You mean $b[2], unless you want a one-element slice? And this
should make the first element of @c a reference to an array if
you use @c = $b[2]. That makes @{$c[0]} the actual array @a.
>$d = @b[2]; # should be even more reliable
Same as above.
>print $#c + 1; # number of elements in @c should be 3
>print $#d + 1; # should also be three
># This prints out 1 and 1.
This is just all fscked up. @c at this point should contain one
element. $d is a reference to an array, while $#d tries to use the
variable @d (that's in a different namespace than $d), which strict
would yell at you for, since you didn't declare it (and I doubt you
meant to use @d instead of $d.)
>Thanks for any info.
Again, read perldoc perlref.
Steve
------------------------------
Date: Tue, 23 May 2000 15:17:43 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Basic Script needed
Message-Id: <Pine.GSO.4.10.10005231514290.23375-100000@user2.teleport.com>
On Tue, 23 May 2000 russ@russ.net wrote:
> #!/usr/bin/perl
> print "What is the username of the user you would like to add? ";
> chop $user;
You should get a good Perl book for beginners. Many folks around here
recommend the Llama book, Learning Perl, from O'Reilly.
> system ("htpasswd passwd.user $user");
I think you really want this module.
http://search.cpan.org/search?dist=Apache-Htpasswd
> system ("tail -1 ~/passwd.user >> ~/public_html/_vti_pvt/service.pwd");
> system ("tail -1 ~/passwd.user >> ~/public_html/fpweb-
> comp/_vti_pvt/service.pwd");
I think you really _really_ want that module. :-)
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 24 May 2000 00:18:12 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Basic scripting question
Message-Id: <392e1f17.1114428@news.skynet.be>
Godzilla! wrote:
>Much of
>our modern code, although efficient and effective,
>when written, resembles Egyptian hierogyphlics and
>does not lend well to reading comprehension.
Hieroglyphics were perfectly readable to the Egyptians. Faster even than
our clumsy English, I would think.
In the same manner, cryptic Perl code is perfectly readable to
programmers used to the idiom.
I compare it to math notation. You can't do advanced math (efficiently)
without learning the lingo first.
--
Bart.
------------------------------
Date: Wed, 24 May 2000 00:04:48 GMT
From: Jim Thomason <jim3@psynet.net>
Subject: bug with 5.004_04?
Message-Id: <jim3-C7F965.19052423052000@news.mntp1.il.home.com>
Okay, I am totally completely stumped. Anyone care to enlighten me?
Here's my code:
#!/usr/local/bin/perl
$file = "string";
$pos = 3;
pos $file = $pos;
sub func ($){return pos $file};
print_pos ("first", pos $file, "second");
print "\n-----\n";
print_pos ("first", func $file , "second");
print "\n-----\n";
print_pos ("first", $pos, "second");
sub print_pos {
my ($arg1, $arg2, $arg3) = @_;
print "My arguments are ($arg1)($arg2)($arg3)\n";
print "But I was handed (@_)\n";
};
===============
Here are the results when run with Perl 5.005_03:
My arguments are (first)(3)(second)
But I was handed (first 3 second)
-----
My arguments are (first)(3)(second)
But I was handed (first 3 second)
-----
My arguments are (first)(3)(second)
But I was handed (first 3 second)
==============
Everything normal so far, but when I run it with perl 5.004_04, I get
this:
My arguments are (first)()(second)
But I was handed (first 3 second)
-----
My arguments are (first)(3)(second)
But I was handed (first 3 second)
-----
My arguments are (first)(3)(second)
But I was handed (first 3 second)
===============
You'll notice that the subroutine (print_pos) didn't pick up the value of
the second argument (pos $file) when it was assigned (my $arg1...= @_).
However, it *is* in the @_ array, as evidenced by the second print
statement.
I've determined that if you print @_, or otherwise refer to it in quotes
("@_") before making the assignment, it'll work just fine. Otherwise,
handing off the pos call like that obviously doesn't work, in perl
5.004_04 at least.
So, changing the subroutine to this:
sub print_pos {
"@_";
my ($arg1, $arg2, $arg3) = @_;
print "My arguments are ($arg1)($arg2)($arg3)\n";
print "But I was handed (@_)\n";
};
will suddenly cause it to work perfectly in 5.004_04, with no other odd
effects.
Obviously, it appears to be a problem with 5.004_04, but I tend to like
more detailed answers than that, so is anyone able to give me a more
detailed idea about what's happening here?
------------------------------
Date: Tue, 23 May 2000 19:51:51 -0300
From: "M Lalonde" <passagewd@primus.ca>
Subject: Cookies for a newbie
Message-Id: <N_DW4.3211$5Q.32900@news1.tor.primus.ca>
I am trying to understand in simple terms what kind of information can be
stored in a cookie and what it's main purpose is. REMEMBER SIMPLE TERMS.
------------------------------
Date: Tue, 23 May 2000 16:02:24 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: Cookies for a newbie
Message-Id: <392B0E00.A6501550@My-Deja.com>
M Lalonde wrote:
> I am trying to understand in simple terms what kind of information can be
> stored in a cookie and what it's main purpose is. REMEMBER SIMPLE TERMS.
Read all about cookies.
http://www.cookiecentral.com/
------------------------------
Date: Tue, 23 May 2000 19:52:08 -0300
From: "M Lalonde" <passagewd@primus.ca>
Subject: Exec() returned - Script exection Error
Message-Id: <V_DW4.3212$5Q.33001@news1.tor.primus.ca>
HELP!
I created my first form script in perl but I can't figure out what the error
message means. Can anyone help?
------------------------------
Date: 23 May 2000 18:17:57 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Exec() returned - Script exection Error
Message-Id: <8766s4onyy.fsf@limey.hpcc.uh.edu>
>> On Tue, 23 May 2000 19:52:08 -0300,
>> "M Lalonde" <passagewd@primus.ca> said:
> HELP!
> I created my first form script in perl but I can't
> figure out what the error message means. Can anyone
> help?
Well, given that you're not telling anyone what this
mysterious error message is, I shouldn't think anyone can
give you any help.
Post:
1. code illustrating the problem.
2. the output/behaviour which was produced.
3. the output/behaviour which was expected.
otherwise you'll get back what you're putting in: nada
------------------------------
Date: Tue, 23 May 2000 20:23:47 -0300
From: "Michael" <passagewd@primus.ca>
Subject: Re: Exec() returned - Script exection Error
Message-Id: <zsEW4.3216$5Q.33057@news1.tor.primus.ca>
The error is:
Script execution error
Unable to execute script due to a configuration problem.
Please notify the webmaster of this error.
exec() returned: 2: No such file or directory
Michael
"Tony Curtis" <tony_curtis32@yahoo.com> wrote in message
news:8766s4onyy.fsf@limey.hpcc.uh.edu...
> >> On Tue, 23 May 2000 19:52:08 -0300,
> >> "M Lalonde" <passagewd@primus.ca> said:
>
> > HELP!
>
> > I created my first form script in perl but I can't
> > figure out what the error message means. Can anyone
> > help?
>
> Well, given that you're not telling anyone what this
> mysterious error message is, I shouldn't think anyone can
> give you any help.
>
> Post:
>
> 1. code illustrating the problem.
> 2. the output/behaviour which was produced.
> 3. the output/behaviour which was expected.
>
> otherwise you'll get back what you're putting in: nada
------------------------------
Date: 23 May 2000 23:29:49 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Exec() returned - Script exection Error
Message-Id: <8gf49d$e7v$1@news.panix.com>
On Tue, 23 May 2000 19:52:08 -0300, M Lalonde <passagewd@primus.ca> wrote:
++
++ I created my first form script in perl but I can't figure out what the error
++ message means. Can anyone help?
It means you have a bug.
HTH. HAND.
Abigail
------------------------------
Date: 23 May 2000 23:32:08 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Exec() returned - Script exection Error
Message-Id: <8gf4do$e7v$2@news.panix.com>
On Tue, 23 May 2000 20:23:47 -0300, Michael <passagewd@primus.ca> wrote:
++ The error is:
++
++ Script execution error
++ Unable to execute script due to a configuration problem.
++ Please notify the webmaster of this error.
++
++ exec() returned: 2: No such file or directory
Which part of the error message didn't you understand?
Wait. Don't answer it here.
None of the above is a Perl error. Do what the error message says:
talk to your webmaster.
Abigail
------------------------------
Date: Tue, 23 May 2000 20:59:24 -0300
From: "Michael" <passagewd@primus.ca>
Subject: Re: Exec() returned - Script exection Error
Message-Id: <4_EW4.3220$5Q.32845@news1.tor.primus.ca>
How can I learn to fix the problem if I don't ask experts like yourself... I
am trying to learn but don't have a webmaster to ask.
"Abigail" <abigail@arena-i.com> wrote in message
news:8gf4do$e7v$2@news.panix.com...
> On Tue, 23 May 2000 20:23:47 -0300, Michael <passagewd@primus.ca> wrote:
> ++ The error is:
> ++
> ++ Script execution error
> ++ Unable to execute script due to a configuration problem.
> ++ Please notify the webmaster of this error.
> ++
> ++ exec() returned: 2: No such file or directory
>
>
> Which part of the error message didn't you understand?
>
> Wait. Don't answer it here.
>
> None of the above is a Perl error. Do what the error message says:
> talk to your webmaster.
>
>
>
> Abigail
------------------------------
Date: 24 May 2000 00:55:15 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Exec() returned - Script exection Error
Message-Id: <slrn8ima3j.4h6.efflandt@efflandt.xnet.com>
On Tue, 23 May 2000 20:59:24 -0300, Michael <passagewd@primus.ca> wrote:
>How can I learn to fix the problem if I don't ask experts like yourself... I
>am trying to learn but don't have a webmaster to ask.
>
>
>"Abigail" <abigail@arena-i.com> wrote in message
>news:8gf4do$e7v$2@news.panix.com...
>> On Tue, 23 May 2000 20:23:47 -0300, Michael <passagewd@primus.ca> wrote:
>> ++ The error is:
>> ++
>> ++ Script execution error
>> ++ Unable to execute script due to a configuration problem.
>> ++ Please notify the webmaster of this error.
>> ++
>> ++ exec() returned: 2: No such file or directory
Doesn't the "No such file or directory" make it quite obvious that
whatever you are trying to exec has an incorrect path or filename.
What might not be so obvious is that if the script you are exec'ing was
not uploaded as ASCII text, the system might be choking trying to find
'perl^M' for the second script when it should be looking for 'perl'.
--
David Efflandt efflandt@xnet.com http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/ http://cgi-help.virtualave.net/
------------------------------
Date: Wed, 24 May 2000 00:59:00 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Exec() returned - Script exection Error
Message-Id: <3931287c.3518879@news.skynet.be>
Tony Curtis wrote:
>Are you going to tell anyone what this error message is?
I think it's the subject line. I haven't seen that one yet. But, if it's
indeed one of Perl's error messages, it should be in "perldiag". It
doesn't seem to be there.
Are you sure it's not a error message from the server?
--
Bart.
------------------------------
Date: Wed, 24 May 2000 00:11:49 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: file locking
Message-Id: <392d1df0.819590@news.skynet.be>
Larry Rosler wrote:
>$| = 1;
>
>'Short' (< 8K?) prints to append.
>
>No buffering.
>
>No locking.
>
>No problem.
Gee, I'm really gonna try to break this "rule" with one counter-example.
If I fail, life will be a lot easier... :-)
--
Bart.
------------------------------
Date: Tue, 23 May 2000 22:15:59 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: How do I extract 2nd and 3rd characters from a string
Message-Id: <slrn8iol91.9qs.tjla@thislove.dyndns.org>
I was shocked! How could Rodney Engdahl <red_orc@my-deja.com>
say such a terrible thing:
>In article <8gee6i$oj6$1@nnrp1.deja.com>,
> olloyd@my-deja.com wrote:
>> What command can I use to extract the 2nd and 3rd characters from a
>> string, regardless of what they are? I'm sure that this is simple to
>> do in Perl, I'm a C programmer and I don't know much about Perl search
>> and extract capabilities.
<snip>
>try:
>
>$Extract23 = substr($String, 1,2);
or in the spirit of TMTOWTDI:
($Extract23) = ($String =~ /.(..)/);
--
Gwyn Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
...and remember, the phrase "software flow control" is only an
abbreviation for the phrase "software flow control problem".
-- Bruce McFarling
------------------------------
Date: Tue, 23 May 2000 15:26:20 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: How do I extract 2nd and 3rd characters from a string
Message-Id: <Pine.GSO.4.10.10005231524210.23375-100000@user2.teleport.com>
On Tue, 23 May 2000, Gwyn Judd wrote:
> Subject: Re: How do I extract 2nd and 3rd characters from a string
> ($Extract23) = ($String =~ /.(..)/);
What you get there may or may not be the second and third characters from
the string. For example, $String may actually be "A\nstring\nof
multiple\nlines\n". Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 23 May 2000 15:33:42 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: How do I extract 2nd and 3rd characters from a string
Message-Id: <MPG.1394a7236e4c534198aac4@nntp.hpl.hp.com>
In article <slrn8iol91.9qs.tjla@thislove.dyndns.org> on Tue, 23 May 2000
22:15:59 GMT, Gwyn Judd <tjla@guvfybir.qlaqaf.bet> says...
> I was shocked! How could Rodney Engdahl <red_orc@my-deja.com>
> say such a terrible thing:
> >In article <8gee6i$oj6$1@nnrp1.deja.com>,
> > olloyd@my-deja.com wrote:
> >> What command can I use to extract the 2nd and 3rd characters from a
> >> string, regardless of what they are? I'm sure that this is simple to
> >> do in Perl, I'm a C programmer and I don't know much about Perl search
> >> and extract capabilities.
>
> <snip>
>
> >try:
> >
> >$Extract23 = substr($String, 1,2);
>
> or in the spirit of TMTOWTDI:
>
> ($Extract23) = ($String =~ /.(..)/);
or in the spirit of achieving almost the same semantics:
($Extract23) = ($String =~ /.?(.{0,2})/s);
As you can see, substr() is a lot cleaner. :-)
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 23 May 2000 10:03:28 -0900
From: "Joshua J. Kugler" <isd@mail.as.uaf.edu>
Subject: Re: Including variables defined outside the script
Message-Id: <8geh79$o2d$1@news.alaska.edu>
In article <392d4e76.3756595@news.skynet.be>, bart.lateur@skynet.be (Bart
Lateur) wrote:
> Because you defined them as lexical variables. That's what my() does for
> you.
Right. Oops.
> You want to define them in %main::, no matter what package they're
> originally in? Then use them as
>
> $::var = 'data';
>
> which even makes 'strict' happy.
OK, I try that, but now I get
Variable "$var" is not imported at file.cgi line 180
This happens whether I use
$::var = 'data';
or
$main::var = 'data';
Isn't there an easy way to include variables? Perl was my first real language, and I love it
then I learned C. All I want to do is #include a file. Is that to much to ask? :)
Thanks!
j----- k-----
--
Joshua Kugler
ASUAF Information Services Director
isd@as.uaf.edu
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 3141
**************************************