[15722] in Perl-Users-Digest
Perl-Users Digest, Issue: 3135 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 23 14:10:50 2000
Date: Tue, 23 May 2000 11:10:28 -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: <959105428-v9-i3135@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 23 May 2000 Volume: 9 Number: 3135
Today's topics:
Comm.pl works on Linux? jason_griffin@3com.com
Re: Converting special chars... <bill.kemp@wire2.com>
Could not create socket: Bad file number paul_kostal@hotmail.com
Re: Could not create socket: Bad file number <red_orc@my-deja.com>
Re: Could not create socket: Bad file number <red_orc@my-deja.com>
Does sleep affect file handles? shinobi97@my-deja.com
Re: Does sleep affect file handles? <jhelman@wsb.com>
Re: Does sleep affect file handles? nobull@mail.com
Re: Does sleep affect file handles? <rootbeer@redcat.com>
Re: Does sleep affect file handles? shinobi97@my-deja.com
Re: Does WARN have a reset?? <lr@hpl.hp.com>
Re: file locking <dan@tuatha.sidhe.org>
Re: file locking (Michel Dalle)
Re: file locking (Michel Dalle)
Re: file locking (Peter J Scott)
Re: file locking <uri@sysarch.com>
Re: file locking <lr@hpl.hp.com>
Re: Haiku <bmb@dataserv.libs.uga.edu>
How do I extract 2nd and 3rd characters from a string olloyd@my-deja.com
Re: How do I extract 2nd and 3rd characters from a stri <tony_curtis32@yahoo.com>
Re: How do I extract 2nd and 3rd characters from a stri <red_orc@my-deja.com>
Re: How do I extract 2nd and 3rd characters from a stri olloyd@my-deja.com
How to enable SSI ? <jilles@psaxeme.com>
How to enable SSI ? <jilles@psaxeme.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 23 May 2000 15:58:19 GMT
From: jason_griffin@3com.com
Subject: Comm.pl works on Linux?
Message-Id: <8ge9qi$l17$1@nnrp1.deja.com>
I downloaded Comm.pl from CPAN and installed it onto my Linux machine.
Whenever, I run open_proc() I get the error:
stty: standard input: Inappropriate ioctl for device
Anyone had any success with Comm.pl on Linux?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 23 May 2000 16:06:43 +0100
From: "W Kemp" <bill.kemp@wire2.com>
Subject: Re: Converting special chars...
Message-Id: <959094496.1395.0.nnrp-06.c3ad6973@news.demon.co.uk>
>> $string =~ tr/\366/o/ ;
>
>What do you have against this:
>
> $string =~ tr/ö/o/ ;
>
>I just copied and pasted that character from the post, without looking
>it up. A better approach in general, I think -- more readable and
>extendable.
The trouble with both of these is that you need to know which encoding
scheme is in use.
It might be safe to assume that you are working in latin-1, but sometimes
Latin-2 is in use.
With uri's at least you know what is really being replaced-hex366, which
might be something else in latin-2, or be displayed in different ways by
different terminal emulators.
Worse still, you can have different pieces of software on one machine that
interpret these 8-bit characters differently, so its not just a case of
platform compatibility - from the command line chr(246) is often a division
sign, print the same thing to a file and a text editor shows it as a
o-umlaut.
Just to top it all, if someone has typed the string into a field on a web
page, it depends on how the browser was set up (or which language was
specified, which the web page _is_supposed_ to dictate). You could even get
a two byte utf-8 representation of the character if you were really lucky.
------------------------------
Date: Tue, 23 May 2000 16:09:10 GMT
From: paul_kostal@hotmail.com
Subject: Could not create socket: Bad file number
Message-Id: <8geaep$lg0$1@nnrp1.deja.com>
Creating a socket in perl gives the error "Could not create socket: Bad
file number".
$main_socket = IO::Socket::INET->new ( LocalAddr => $my_host,
LocalPort => $my_port,
Listen => 5,
Proto => 'tcp',
Reuse => 1);
die "Could not create socket: $! \n" unless $main_socket;
I am currently using Perl 5.005 on Solaris 2.6.
Can anybody help me ?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 23 May 2000 16:34:48 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: Could not create socket: Bad file number
Message-Id: <8gebv6$mpe$1@nnrp1.deja.com>
In article <8geaep$lg0$1@nnrp1.deja.com>,
paul_kostal@hotmail.com wrote:
> Creating a socket in perl gives the error "Could not create socket:
Bad
> file number".
>
> $main_socket = IO::Socket::INET->new ( LocalAddr => $my_host,
> LocalPort => $my_port,
> Listen => 5,
> Proto => 'tcp',
> Reuse => 1);
> die "Could not create socket: $! \n" unless $main_socket;
>
> I am currently using Perl 5.005 on Solaris 2.6.
> Can anybody help me ?
>
substituting the correct ipaddr for the local machine for $my_host, and
substituting '9000' for $my_port, this code works on my system running
5.00504 and Solaris 7.
What are your values for $my_port and $my_host?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 23 May 2000 16:37:33 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: Could not create socket: Bad file number
Message-Id: <8gec4b$ms9$1@nnrp1.deja.com>
In article <8geaep$lg0$1@nnrp1.deja.com>,
paul_kostal@hotmail.com wrote:
<OT>
any relation to Irwin Kostal, the composer/orchestrator?
</OT>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 23 May 2000 16:06:38 GMT
From: shinobi97@my-deja.com
Subject: Does sleep affect file handles?
Message-Id: <8geaa2$leg$1@nnrp1.deja.com>
I wrote a little script to ping a machine every 5 seconds and log the
result to a log file. The problem is if I use the sleep function all I
get is a 0-byte log file. If I remove the call to sleep the program
works fine (ie. it pings the machine as fast as it can and logs
everything). Why doesn't this work?? I've pasted the code I'm trying
to use:
#!/usr/bin/perl -w
use Net::Ping;
use Time::localtime;
use diagnostics;
$|++;
my $host = "geek.net";
my $wait = 5;
my $p = Net::Ping->new("icmp");
my $now;
open(LOG, ">>ping.log");
while(1) {
$now = ctime();
if($p->ping($host,2)) {
print LOG "[$now] $host is up.\n";
} else {
print LOG "[$now] $host is unreachable.\n";
}
sleep $wait;
}
$p->close();
close(LOG);
P.S.: You have to run this as root for ICMP pings to work.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 23 May 2000 17:16:05 GMT
From: Jeff Helman <jhelman@wsb.com>
Subject: Re: Does sleep affect file handles?
Message-Id: <392ABCF9.29B69EE@wsb.com>
See the added line below. You flushed output for STDOUT, but not your
output file. After adding the line, my test showed things working as
intended.
> #!/usr/bin/perl -w
>
> use Net::Ping;
> use Time::localtime;
> use diagnostics;
>
> $|++;
>
> my $host = "geek.net";
> my $wait = 5;
> my $p = Net::Ping->new("icmp");
> my $now;
> open(LOG, ">>ping.log");
## FLUSH OUTPUT FOR LOG FILE
select LOG; $| = 1; select STDOUT;
>
> while(1) {
> $now = ctime();
> if($p->ping($host,2)) {
> print LOG "[$now] $host is up.\n";
> } else {
> print LOG "[$now] $host is unreachable.\n";
> }
> sleep $wait;
> }
> $p->close();
> close(LOG);
>
JH
----------------------------------------------------------------
Jeff Helman Product Manager -- Internet Services
jhelman@wsb.com CCH Washington Service Bureau
----------------------------------------------------------------
------------------------------
Date: 23 May 2000 18:04:00 +0100
From: nobull@mail.com
Subject: Re: Does sleep affect file handles?
Message-Id: <u9vh05kxkv.fsf@wcl-l.bham.ac.uk>
shinobi97@my-deja.com writes:
> I wrote a little script to ping a machine every 5 seconds and log the
> result to a log file. The problem is if I use the sleep function all I
> get is a 0-byte log file. If I remove the call to sleep the program
> works fine (ie. it pings the machine as fast as it can and logs
> everything). Why doesn't this work??
Output buffering.
> $|++;
$| is per filehandle. You probably want to do this on the log file
not STDOUT.
> open(LOG, ">>ping.log");
Tut, tut.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 23 May 2000 10:20:31 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Does sleep affect file handles?
Message-Id: <Pine.GSO.4.10.10005231015210.23375-100000@user2.teleport.com>
On Tue, 23 May 2000 shinobi97@my-deja.com wrote:
> Subject: Does sleep affect file handles?
I don't think it should....
> #!/usr/bin/perl -w
That's a good start. You should probably use 'use strict' as well.
> use Net::Ping;
> use Time::localtime;
> use diagnostics;
Of course, you know that 'diagnostics' isn't meant to be left in code
after development - it adds a lot to your load time and memory usage, in
general.
> $|++;
>
> my $host = "geek.net";
> my $wait = 5;
> my $p = Net::Ping->new("icmp");
> my $now;
> open(LOG, ">>ping.log");
Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.
Did you realize that writes to LOG will probably be buffered? Setting $|
above didn't change that. Could that be part of the problem you're seeing?
> while(1) {
> $now = ctime();
> if($p->ping($host,2)) {
> print LOG "[$now] $host is up.\n";
> } else {
> print LOG "[$now] $host is unreachable.\n";
> }
> sleep $wait;
> }
> $p->close();
> close(LOG);
Of course, you should never reach those last two lines, right?
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 23 May 2000 17:35:45 GMT
From: shinobi97@my-deja.com
Subject: Re: Does sleep affect file handles?
Message-Id: <8gefhg$pk1$1@nnrp1.deja.com>
Never mind...I found the problem. I should have realized this but I'm
posting the fix in case anyone else make the same mistake.
The problem is that I didn't explicitly disable output buffering on
the newly created file handle. So I added some code just after I create
the file handle to do this. BTW, the select() method I used below
is in the Programming Perl book. I've posted the resultant code:
#!/usr/bin/perl -w
use Net::Ping;
use Time::localtime;
use diagnostics;
$|++;
my $host = "geek.net";
my $wait = 5;
my $p = Net::Ping->new("icmp");
my $now;
open(LOG, ">>ping.log");
select((select(LOG), $|=1)[0]);
#
# Or this would work if using the FileHandle module:
#
# LOG->autoflush(1);
while(1) {
$now = ctime();
if($p->ping($host,2)) {
print LOG "[$now] $host is up.\n";
} else {
print LOG "[$now] $host is unreachable.\n";
}
sleep $wait;
}
$p->close();
close(LOG);
In article <8geaa2$leg$1@nnrp1.deja.com>,
shinobi97@my-deja.com wrote:
> I wrote a little script to ping a machine every 5 seconds and log
the
> result to a log file. The problem is if I use the sleep function all
I
> get is a 0-byte log file. If I remove the call to sleep the program
> works fine (ie. it pings the machine as fast as it can and logs
> everything). Why doesn't this work?? I've pasted the code I'm trying
> to use:
>
> #!/usr/bin/perl -w
>
> use Net::Ping;
> use Time::localtime;
> use diagnostics;
>
> $|++;
>
> my $host = "geek.net";
> my $wait = 5;
> my $p = Net::Ping->new("icmp");
> my $now;
> open(LOG, ">>ping.log");
>
> while(1) {
> $now = ctime();
> if($p->ping($host,2)) {
> print LOG "[$now] $host is up.\n";
> } else {
> print LOG "[$now] $host is unreachable.\n";
> }
> sleep $wait;
> }
> $p->close();
> close(LOG);
>
> P.S.: You have to run this as root for ICMP pings to work.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 23 May 2000 09:54:06 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Does WARN have a reset??
Message-Id: <MPG.1394578cfa52d77498aaba@nntp.hpl.hp.com>
[Please respond after the material you are responding to, not before.]
In article <392A9962.7C4475A9@ntx.waymark.net> on Tue, 23 May 2000
09:44:50 -0500, Tom Turton <tturton@ntx.waymark.net> says...
...
> Having messed around with PERL for almost 3 years now, and read enough
> on this newsgroup to NEVER, EVER write a program without 'use
> diagnostics', I was a bit surprised by this 'feature' of Perl ;-)
Are you misapplying the consensus about 'use strict;' to 'use
diagnostics'?
The 'diagnostics' pragma is overkill. It is very slow to load, and
provides no information that cannot be found in perldiag. If your
programs are warning-free (as they should be), the 'diagnostics' module
is just baggage at compile time.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 23 May 2000 15:45:12 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: file locking
Message-Id: <cIxW4.90589$hT2.381866@news1.rdc1.ct.home.com>
Michel Dalle <michel.dalle@usa.net> wrote:
> In article <v2eW4.89858$hT2.379447@news1.rdc1.ct.home.com>, Dan Sugalski <dan@tuatha.sidhe.org> wrote:
>>You can be bit hard by buffering with print in a number of ways, which is
>>always fun. Interleaved output, garbage, missing bits--way fun. :)
> Hmmm, guess I've been relying too much on the O.S. lately. :(
> I noticed the 'garbled' output too, but only when larger pieces of
> data are appended - hence my remark about the 'larger chunks'.
Bad, bad programmer! No cookie for you! :)
> I've never seen any problems with appending a single line to a
> logfile, though... Have I been lucky so far, or would that qualify
> as a single write() operation ?
You've been lucky. A 2-byte print to a file can theoretically span blocks,
and thus be geeked.
If the file is being used by multiple writers, you *must* lock it if you
want any sort of data integrity. If you don't care, of course, you don't
have to. (But in that case, why bother with the data in the first place?)
Dan
------------------------------
Date: Tue, 23 May 2000 16:12:34 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: file locking
Message-Id: <8geaoe$2ds$1@news.mch.sbs.de>
In article <m1u2fpwd5r.fsf@halfdome.holdit.com>, merlyn@stonehenge.com (Randal L. Schwartz) wrote:
>>>>>> "Rick" == Rick Delaney <rick.delaney@home.com> writes:
>
>Rick> Can you produce an example program that will reproduce this behaviour?
>Rick> I've never been able to get garbled output, despite numerous attempts.
After some trouble, I managed to "scramble" some output by launching
about 30 processes in background, each trying to append a few
hundreds of long lines and sleeping for a second between every 16
prints.
(This behaviour roughly corresponds to what I saw happen e.g. in
the debugging logfiles for some Java application.)
>>> I've never seen any problems with appending a single line to a
>>> logfile, though... Have I been lucky so far, or would that qualify
>>> as a single write() operation ?
>
>Rick> <aol>I'd like to know the answer to this too.</aol>
>
>"asked and answered", the lawyers would scream. Just go up a few
>messages in this thread.
>
>If it's less than the buffering size of your STDIO buffer (typically
>8K or so), it's probably gonna be a single write(2) call, and you get
>O/S assistance to ensure atomicity. If it's greater than that, you
>will probably lose at some point. Solution, use syswrite(), but be
>prepared for the rare short write (which again won't be atomic, but at
>least you'll know it happened).
Thanks, this seems to confirm that for appending a single line of
information, a simple open(...,">> ") - print - close would be
reliable enough in most cases...but that larger blocks of data
need to be handled with a bit more care.
You managed to scare me, Randal and Dan :)
Michel.
------------------------------
Date: Tue, 23 May 2000 16:29:51 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: file locking
Message-Id: <8gebor$321$1@news.mch.sbs.de>
In article <cIxW4.90589$hT2.381866@news1.rdc1.ct.home.com>, Dan Sugalski <dan@tuatha.sidhe.org> wrote:
>Michel Dalle <michel.dalle@usa.net> wrote:
[snip of cookie monster :)]
>> I've never seen any problems with appending a single line to a
>> logfile, though... Have I been lucky so far, or would that qualify
>> as a single write() operation ?
>
>You've been lucky. A 2-byte print to a file can theoretically span blocks,
>and thus be geeked.
Wait - let me get this 100% clear. I open a file for append, print
a single line (of less than BUFSIZ) to it and close it again.
Are you telling me this could theoretically span blocks ?
If so, I definitely need to review my understanding of how
I/O really works - and I think I'm not the only one here...
Michel.
------------------------------
Date: Tue, 23 May 2000 16:38:45 GMT
From: peter@PSDT.com (Peter J Scott)
Subject: Re: file locking
Message-Id: <puyW4.37831$q_4.1001778@news1.gvcl1.bc.home.com>
In article <cIxW4.90589$hT2.381866@news1.rdc1.ct.home.com>,
Dan Sugalski <dan@tuatha.sidhe.org> writes:
>Michel Dalle <michel.dalle@usa.net> wrote:
>> I've never seen any problems with appending a single line to a
>> logfile, though... Have I been lucky so far, or would that qualify
>> as a single write() operation ?
>
>You've been lucky. A 2-byte print to a file can theoretically span blocks,
>and thus be geeked.
But suppose the logfile writer opens the file for append, prints a line (< 8k) and then
closes it... that write() couldn't span blocks, it should be starting at the beginning
of a block.
--
Peter Scott
------------------------------
Date: Tue, 23 May 2000 16:39:14 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: file locking
Message-Id: <x7aehhcjbh.fsf@home.sysarch.com>
>>>>> "MD" == Michel Dalle <michel.dalle@usa.net> writes:
MD> Wait - let me get this 100% clear. I open a file for append, print
MD> a single line (of less than BUFSIZ) to it and close it again.
that should work but if you did multiple prints, one could overlap the
buffer end and cause 2 system writes which would break atomicity.
MD> Are you telling me this could theoretically span blocks ?
MD> If so, I definitely need to review my understanding of how
MD> I/O really works - and I think I'm not the only one here...
you do seem to need to learn more about buffered I/O. it is not just I/O
but the buffering which can break things when multiple programs print to
the same file. if you use syswrite, it is atomic. print uses buffered
I/O which is not atomic by design.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Tue, 23 May 2000 09:58:16 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: file locking
Message-Id: <MPG.1394588314be6e1598aabb@nntp.hpl.hp.com>
In article <x7aehhcjbh.fsf@home.sysarch.com> on Tue, 23 May 2000
16:39:14 GMT, Uri Guttman <uri@sysarch.com> says...
> >>>>> "MD" == Michel Dalle <michel.dalle@usa.net> writes:
>
> MD> Wait - let me get this 100% clear. I open a file for append, print
> MD> a single line (of less than BUFSIZ) to it and close it again.
>
> that should work but if you did multiple prints, one could overlap the
> buffer end and cause 2 system writes which would break atomicity.
>
> MD> Are you telling me this could theoretically span blocks ?
> MD> If so, I definitely need to review my understanding of how
> MD> I/O really works - and I think I'm not the only one here...
>
> you do seem to need to learn more about buffered I/O. it is not just I/O
> but the buffering which can break things when multiple programs print to
> the same file. if you use syswrite, it is atomic. print uses buffered
> I/O which is not atomic by design.
$| = 1;
'Short' (< 8K?) prints to append.
No buffering.
No locking.
No problem.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 23 May 2000 13:57:38 -0400
From: Brad Baxter <bmb@dataserv.libs.uga.edu>
Subject: Re: Haiku
Message-Id: <Pine.GSO.4.21.0005231356430.9692-100000@dataserv.libs.uga.edu>
On Tue, 23 May 2000, Elaine Ashton wrote:
> in article Pine.GSO.4.21.0005222251010.6089-100000@dataserv.libs.uga.edu,
> Brad Baxter at bmb@dataserv.libs.uga.edu quoth:
>
> > Okay, here's my haiku entry. (I forget the rules.)
>
> http://history.perl.org/CHI/ :)
Much obliged, Ma'am. :-)
--
Brad
------------------------------
Date: Tue, 23 May 2000 17:13:06 GMT
From: olloyd@my-deja.com
Subject: How do I extract 2nd and 3rd characters from a string
Message-Id: <8gee6i$oj6$1@nnrp1.deja.com>
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.
Example
$String = B05348503ACK3240
$Extract23 = //Extract command
Where $Extract = 05 when this is finished
Thanks in advance for any help you can give me
Owen
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 23 May 2000 12:25:23 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: How do I extract 2nd and 3rd characters from a string
Message-Id: <87hfbpji0s.fsf@limey.hpcc.uh.edu>
>> On Tue, 23 May 2000 17:13:06 GMT,
>> olloyd@my-deja.com said:
> 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.
perldoc -f substr
hth
t
------------------------------
Date: Tue, 23 May 2000 17:21:18 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: How do I extract 2nd and 3rd characters from a string
Message-Id: <8geelr$ovg$1@nnrp1.deja.com>
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.
>
> Example
>
> $String = B05348503ACK3240
missing trailing ';'
>
> $Extract23 = //Extract command
perlfaq4, available at www.cpan.org, reveals the answer to your
question:
"How can I access/change the first N letters of a string?"
try:
$Extract23 = substr($String, 1,2);
>
> Where $Extract = 05 when this is finished
>
> Thanks in advance for any help you can give me
> Owen
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 23 May 2000 17:35:11 GMT
From: olloyd@my-deja.com
Subject: Re: How do I extract 2nd and 3rd characters from a string
Message-Id: <8gefge$pjm$1@nnrp1.deja.com>
In article <8geelr$ovg$1@nnrp1.deja.com>,
Rodney Engdahl <red_orc@my-deja.com> wrote:
> 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.
> >
> > Example
> >
> > $String = B05348503ACK3240
>
> missing trailing ';'
>
> >
> > $Extract23 = //Extract command
>
> perlfaq4, available at www.cpan.org, reveals the answer to your
> question:
>
> "How can I access/change the first N letters of a string?"
>
> try:
>
> $Extract23 = substr($String, 1,2);
>
> >
> > Where $Extract = 05 when this is finished
> >
> > Thanks in advance for any help you can give me
> > Owen
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
> >
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Thanks a million, it worked.
Owen
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 23 May 2000 17:57:18 GMT
From: "Jilles F." <jilles@psaxeme.com>
Subject: How to enable SSI ?
Message-Id: <2EzW4.119890$r37.1545156@news20.bellglobal.com>
Hello,
I would like to know what are the procedures to enable SSI in order for a
script to be runned from a .shtml page.
All I have to do is to enable SSI execute and SSI include, but how?
------------------------------
Date: Tue, 23 May 2000 17:59:13 GMT
From: "Jilles F." <jilles@psaxeme.com>
Subject: How to enable SSI ?
Message-Id: <RFzW4.119904$r37.1543376@news20.bellglobal.com>
Hello,
I would like to know what are the procedures to enable SSI in order for a
script to be runned from a .shtml page.
All I have to do is to enable SSI execute and SSI include, but how?
------------------------------
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 3135
**************************************