[9625] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3219 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 21 21:17:13 1998

Date: Tue, 21 Jul 98 18:00:23 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 21 Jul 1998     Volume: 8 Number: 3219

Today's topics:
    Re: Cant figure pattern matching exp =~ (Martien Verbruggen)
    Re: clp.moderated <rra@stanford.edu>
    Re: clp.moderated <rra@stanford.edu>
    Re: Debugging Perl 5.x (Jack Ostroff)
        GET & PUT from commandline <JLEHMANN@dsccc.com>
    Re: GET & PUT from commandline <rfeldman_@_sftek.com>
        Gif Image Questions <harmanjd@cda.mrs.umn.edu>
        How to delete files from perl <neelam@healtheon.com>
    Re: How to delete files from perl <ahaas@neosoft.com>
    Re: novice Q; reading columns of numbers <merlyn@stonehenge.com>
        package & run time order <salisbur@fsl.noaa.gov>
        passing data from a form to another cgi app <jeoff.remove@geocities.com>
    Re: Perl 5.004_04 Configure script fails on Solaris... (Martien Verbruggen)
    Re: Perl CGI's under Windows NT <metcher@spider.herston.uq.edu.au>
        perl compiler module question <javier@sitematic.com>
    Re: Perl for kids <p-fein@uchicago.edu>
        problem with call to IO::Socket <sirron@mail.mcoe.k12.ca.us>
        problems compiling perl5 on sun (Henryrb)
    Re: Reading in an email message into a Perl program (-)
        Space for Cgi's or PERL (HuronFrosh)
        specific character/position in string (Michael Shavel)
    Re: specific character/position in string (Larry Rosler)
    Re: specific character/position in string <ajohnson@gpu.srv.ualberta.ca>
    Re: specific character/position in string (Andre L.)
        Telnet problems with connecting to VMS sessions (FrostPS)
    Re: Using splice with for (Jack Ostroff)
    Re: What's wrong? <rra@stanford.edu>
        which of these would be faster? <rfeldman_@_sftek.com>
    Re: which of these would be faster? (Andre L.)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 22 Jul 1998 00:34:34 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Cant figure pattern matching exp =~
Message-Id: <6p3c2q$8v$1@nswpull.telstra.net>

I said:

>> > BUT what is happening with the $_ =~ s? ??g;
>> 
>> This is equivalent to 
>> 
>> s/ //g;

In article <MPG.101da7e7f6220241989771@nntp.hpl.hp.com>,
	lr@hpl.hp.com (Larry Rosler) writes:

> Almost equivalent :-).  It can match only once, unless/until 'reset' is 
> executed in the same package.  See a recent thread on this bit of arcana.
> 'perlop' says "This usage is vaguely deprecated, and may be removed in 
> some future version of Perl." but I doubt it.

perlop only mentions ?PATTERN?, with a note for m?PATTERN?. It doesn't
mention specifically that s?PATTERN/REPLACEMENT? also follows these
rules. (checked 5.004_04 and 5.004_64 docs)

A little test program says:

#!/usr/local/bin/perl -w
use strict;

my $a = "foo foo foo";
$a =~ s/foo/bar/g;
print "$a\n";
$a = "foo foo foo";
$a =~ s?foo?bar?g;
print "$a\n";

__END__
bar bar bar
bar bar bar

Am I misunderstanding the point, or is the documentation right? :)

Martien
-- 
Martien Verbruggen                  | My friend has a baby. I'm writing down
Webmaster www.tradingpost.com.au    | all the noises the baby makes so later
Commercial Dynamics Pty. Ltd.       | I can ask him what he meant - Steven
NSW, Australia                      | Wright


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

Date: 21 Jul 1998 15:25:01 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: clp.moderated
Message-Id: <m34swakfk2.fsf@windlord.Stanford.EDU>

David Coldrick <davidc@selectst.com> writes:

> Anyone have the details on how to register for perl moderated? Only
> thing I've found is a ref to something on plover.com that says you need
> to give the right subject to your email request, but doesn't actually
> say what that subject is to be :-(

If you just post, you'll get return e-mail that will let you register.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 21 Jul 1998 16:08:29 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: clp.moderated
Message-Id: <m3oguiiyz6.fsf@windlord.Stanford.EDU>

Russ Allbery <rra@stanford.edu> writes:
> David Coldrick <davidc@selectst.com> writes:

>> Anyone have the details on how to register for perl moderated? Only
>> thing I've found is a ref to something on plover.com that says you need
>> to give the right subject to your email request, but doesn't actually
>> say what that subject is to be :-(

> If you just post, you'll get return e-mail that will let you register.

(Oh, and for the record, yes there is a way of registering a spam blocked
address that should work fine; please contact mjd-clpm-admin@plover.com
for right now if you need to do it, and it will be in the regular
posting.)

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 21 Jul 1998 20:04:20 GMT
From: ostroj@gsun150.pfizer.com (Jack Ostroff)
Subject: Re: Debugging Perl 5.x
Message-Id: <6p2s84$1ub3@mascagni.pfizer.com>

In article <6p2pfv$4o5$1@nnrp1.dejanews.com>, skillit@my-dejanews.com writes:
> $ test2.pl
> Bad name after CLEARSTART_HOME:: at test2.pl line 36.
> 
>  I am really getting tired of this message!!!!
> Does anyone know of a good resource for debugging perl?
> Is there a perldoc explaining error messages?
> 

"use diagnostics;" will get you more verbose warnings.
Also, at risk of restarting another flamefest, "use strict"
would probably help a great deal - except for the inital 
effort of cleaning up any "non-strict" usages in the program.

Good luck


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

Date: Tue, 21 Jul 1998 16:52:40 -0500
From: JLEHMANN <JLEHMANN@dsccc.com>
Subject: GET & PUT from commandline
Message-Id: <35B50DA8.6CCF4FAF@dsccc.com>

In win95, how can you pass GET and PUT information to your perl script
for testing?  For instance, I'd like to be able to simulate "perl
login.pl?newuser".

Thanks,
John


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

Date: Tue, 21 Jul 1998 16:01:32 -0700
From: "Ron Feldman" <rfeldman_@_sftek.com>
Subject: Re: GET & PUT from commandline
Message-Id: <6p36dq$17n@newshub.atmnet.net>

With our scripts (not on Win95, but this should be the same), there are
usually associations passed, as in "login.pl?user=newuser" and we can
simulate that input by assigning values to the %in array, as in

$DEBUG = 1;

if (DEBUG == 1)
{
    $in{'user'}="newuser";
}

It isn't as flexible as being able to pass parameters on the command line,
but it does work.

Maybe with no field=value pairs, your array isn't associative, and you can
just assign like

$in[0]="newuser";

See if that works until someone more knowledgable than me replies!

 ..Ron

JLEHMANN wrote in message <35B50DA8.6CCF4FAF@dsccc.com>...
>In win95, how can you pass GET and PUT information to your perl script
>for testing?  For instance, I'd like to be able to simulate "perl
>login.pl?newuser".
>
>Thanks,
>John




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

Date: Tue, 21 Jul 1998 17:36:16 -0500
From: James Harman <harmanjd@cda.mrs.umn.edu>
Subject: Gif Image Questions
Message-Id: <Pine.OSF.3.95.980721173359.32369D-100000@cda.mrs.umn.edu>


I would like to determine if a given gif is anitmated or not animated, and
also get the dimensions of the gif.  Does anybody know how to do this?
(Someone has mentioned the GD module to me but has anybody used it that
could help me work this out?)

Thanks,

James

------

signoff	 
	 _______________________________________________________
	| James Harman		email: harmanjd@cda.mrs.umn.edu |
	| Colorado Native	http://www.mrs.umn.edu/~harmanjd|
	| ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, |
	| Interested in Web advertising?  Try Internet Traffic  |
	| Exchange - http://trafficx.com/            		|
	|_______________________________________________________|





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

Date: Tue, 21 Jul 1998 16:14:39 -0700
From: Neelam Saini <neelam@healtheon.com>
Subject: How to delete files from perl
Message-Id: <35B520DF.97D60B81@healtheon.com>

Using perl on UNIX. How do I delete files from perl. I am creating the
file using open <filename>

Thanks



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

Date: Wed, 22 Jul 1998 13:14:28 +0000
From: Art Haas <ahaas@neosoft.com>
Subject: Re: How to delete files from perl
Message-Id: <35B5E5B4.9DB9D1ED@neosoft.com>

Neelam Saini wrote:
> 
> Using perl on UNIX. How do I delete files from perl. I am creating the
> file using open <filename>
> 
> Thanks

$filename = join(".",'/tmp/bogus',$$);
open(FILE,">$filename") || die "Can't open file '$filename'!\n";
print FILE "I'm doomed!\n";
close(FILE);

unlink($filename); # Delete files with 'unlink()'

perldoc perlfunc

will give you more info.

Art Haas


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

Date: Tue, 21 Jul 1998 22:50:49 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: novice Q; reading columns of numbers
Message-Id: <8cww96strw.fsf@gadget.cscaper.com>

>>>>> "John" == John Porter <jdporter@min.net> writes:

John> It occurred to me that the upper map is superfluous, in the
John> predicate of a foreach.  So:

John> for (
John>   sort { $a->[0] <=> $b->[0] }
John>   map { [...] } <DATA>
John> ) {
John>   print join( ',', @{$_->[1]} ), "\n";
John> }

John> Or, of course:

John> print join "\n", 
John>   map { join ',', @{$_->[1]} }
John>   sort { $a->[0] <=> $b->[0] }
John>   map { [...] } <DATA>;

Or of course:

print map { join (",", @{$_->[1]}), "\n" } sort { ... } map { ... }

print "Just another Map-sort-map hacker,"

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Tue, 21 Jul 1998 17:50:50 -0700
From: Dave Salisbury <salisbur@fsl.noaa.gov>
Subject: package & run time order
Message-Id: <35B5376A.CF502BE5@fsl.noaa.gov>

I'm a bit new to perl5 stuff, but in trying to get
mod_perl to work, I've had to add "package somename"
to many required libraries so as not to have "undefine
subroutine" error messages.  but I am having a hell
of a time getting things to work.  Can anyone offer me a
reason for the following:

print "first print\n";
PACKAGE::subroutine;
print "second print\n";

-------
package PACKAGE;

sub subroutine {
print "another print\n";
}
------------

and when run the output is:

first print
second print
another print


Seems this isn't just a print buffer thing, as the rest on
the program displays these symptoms.  Any pointers on why
would be appreciated.

Thanks,
Dave





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

Date: Sun, 19 Jul 1998 13:17:08 -0700
From: "Jeoff Micalizzi" <jeoff.remove@geocities.com>
Subject: passing data from a form to another cgi app
Message-Id: <6otk8r$lv4$1@speedx1.speed.net>

Does anyone know how to take data from a browser based form, pass it to
another cgi app and parse the results?

Thanks,
Jeoff Micalizzi
jeoff@geocities.com




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

Date: 22 Jul 1998 00:40:09 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Perl 5.004_04 Configure script fails on Solaris...
Message-Id: <6p3cd9$8v$2@nswpull.telstra.net>

In article <35B507E3.2855A9E8@transarc.com>,
	Chris Mason <cmason@transarc.com> writes:
> I grabbed 5.004_04 off CPAN, untarred, ran sh Configure. It just dies at
> the prompt:
> 
> Which of these apply, if any? [solaris_2]

That is odd. I have compiled it here on Solaris 2.5.1 and 2.6, without
any problems. 

> I followed instructions to the letter.  I think this is a problem with the
> read code in the shell scripts.  If I type stuff at this prompt, it doesn't
> get echoed back.  However, it seems like it's getting evaled somehow.  If I
> type

What is sh for you? Does it maybe point off to some odd shell? Try 

# /usr/bin/sh Configure

and see if that helps.

What I normally do is

# sh Configure -des

If I need anything changed, I can change the config files. I just
don't want to wait for 50 prompts to answer :). The Configure scripts
hasn't really guessed wrong for me yet.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | 75% of the people make up 3/4 of the
Commercial Dynamics Pty. Ltd.       | population.
NSW, Australia                      | 


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

Date: Wed, 22 Jul 1998 08:56:00 +1000
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: Re: Perl CGI's under Windows NT
Message-Id: <35B51C80.7B02B89F@spider.herston.uq.edu.au>

scott@softbase.com wrote:
> 
> I have solved this problem, and ought to write up a web page about
> it since it gets asked so often.
> 
> With both IIS and PWS: *DO* *NOT* *USE* *PERL.EXE* !!!!!!!
> 
> It won't work. I've never gotten it to work. It's hopeless. Cut
> your losses and get out while you can. Typical losses include:
> 
<snip>

Ahem...I can't talk about PWS, but the standard Sarathy port of perl
definitely works with IIS.  As I recall, all that's required is the
script mapping (with the %s %s parameters, as detailed in many a
FAQ).    I've no doubt you've struck a glitch somewhere and found a
valid workaround, but saying "it's hopeless" is a bit strong.

-- 
Jaime Metcher (trying to encourage people to use the GS port)


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

Date: Tue, 21 Jul 1998 15:43:34 -0700
From: Javier Vegas <javier@sitematic.com>
Subject: perl compiler module question
Message-Id: <35B51996.167EB0E7@sitematic.com>

Hello, there.

I am experimenting with the Compiler module. Works fine for me for
simple scripts, but I can not figure out a way of making it work for
scripts that use external modules, like CGI.pm, and there is nothing
in the Compiler module documentation about that.

Can anyone give me some pointers here?

Thanks, Javier
________________________________________________________________
Javier Vegas                       javier@sitematic.com
Sitematic Corp.                    http://www.sitematic.com
433 G Street, Suite 203            phone 619-234-6800 ext 105
San Diego, CA  92101               fax 619-338-9736


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

Date: Tue, 21 Jul 1998 22:00:00 GMT
From: Peter A Fein <p-fein@uchicago.edu>
Subject: Re: Perl for kids
Message-Id: <opg3ebu6f1b.fsf@harper.uchicago.edu>

linberg@literacy.upenn.edu (Steve Linberg) writes:

> 
> In article <35B42545.509ACE1A@steelplan.com.au>, ryan@steelplan.com.au wrote:
> 
> > Steve Linberg wrote:
> > 
> > > I love Perl -- it *is* the game --, but I'm glad I didn't start with it.
> > > Plain vanilla C taught me more about programming than anything else,
> > > because you can't write C without understanding memory, data types, and
> > > data structures.  Once you know C, you can really appreciate everything
> > > Perl does for you.  It certainly isn't the easiest place to start, though.
> > 
> > At the wee age of 20, I find it easier to learn Perl than it is to learn C...
> > Don't ask why.
> 
> That's what I meant - that C isn't the easiest place to start.  I've heard
> it said of the guitar that it is the easiest instrument to learn and the
> hardest to master.  I think Perl is kind of like that. :)

Played with Scheme lately?  Very easy to learn- next to no syntax &
about half a dozen reserved words, but I'll be damned if I ever do
anything productive in that language.  (Not looking to start a
language war; CompSci has got me down.)

-- 
Peter A Fein                                           Summering in SF!
Home: 650-571-6476                                   Work: 650-628-2172
p-fein@uchicago.edu                             pfein@us.checkpoint.com
Gilette's Razor: The best a man can get.


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

Date: Tue, 21 Jul 1998 15:33:55 -0700
From: Joseph Norris <sirron@mail.mcoe.k12.ca.us>
Subject: problem with call to IO::Socket
Message-Id: <35B51753.A3E354F1@mail.mcoe.k12.ca.us>

Hello group,

I have been playing with the socket examples in the Advanced Perl
Programming book on pages 191-194. I have created the receiver script,
start it up and it hangs there waiting for another script to talk to. I
have written the sender script, fire it up and I get the following in my
error condition:

if (!$sock){
  die "socket problem - Reason: $!\n";
}
socket problem - Reason: Bad file descriptor

Can anyone direct me to where I might be having a problem with the file
discriptor?

thanks!
--
Joseph Norris (Perl - what else is there?/Linux/CGI/Mysql)
print @c=map chr
$_+100,(6,17,15,16,-68,-3,10,11,16,4,1,14,-68,12,1,14,8,
-68,4,-3,-1,7,1,14,-68,6,11,15,1,12,4,-68,-22,11,14,14,5,15,-90);




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

Date: 21 Jul 1998 22:22:01 GMT
From: henryrb@aol.com (Henryrb)
Subject: problems compiling perl5 on sun
Message-Id: <1998072122220100.SAA09045@ladder01.news.aol.com>

Hi, I have a sunos 5.5.1 sun4u sparc SUNW,Ultra-5_10 machine.  I've tried
compiling it and used the hints in the install file, but I can't even get it to

make anymore - it says

/bin/sh: -Wl, -export-dynamic: cannot open
make: *** [perl] Error 1

Any ideas?  Earlier it was having problems finding the 'main' symbol from
various libraries.

E-mail replies appreciated

Thanks



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

Date: Tue, 21 Jul 1998 22:31:35 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: Reading in an email message into a Perl program
Message-Id: <35b515f0.98701936@news2.cais.com>

rjk@coos.dartmouth.edu (Ronald J Kimball) Said this:

>
>It still doesn't quite work; you didn't address the bug I pointed out.
>
>For multiline headers all lines after the first are concatenated onto
>$fields{''}.

But considering the use of this script, it isn't a bug.  If I don't
want those headers, how can it be a bug that it doesn't grab them.....





>
>> Like i mentioned above, I've been using this for 2 years, and I've
>> never had it "break" in any way.  Of course, I'm not keying into the
>> Received: lines or any other multiline header data.
>
>I guess that is why you've never seen the above bug manifested.  Fair
>enough.  I made the same sort of mistake with my initial correction!
>:-)

Actually, I tend to think of it as a "feature", not a bug (oh jeez,
now I'm starting to sound like microsoft!!) 

No seriously, in "mail filtering" use, there is only a few reasons to
want to capture any multi-line headers (or headers that appear more
than once, as in Received).  For most purposes, it's not necessary,
therefore it's not a bug that it misses that data.




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

Date: 21 Jul 1998 23:43:15 GMT
From: huronfrosh@aol.com (HuronFrosh)
Subject: Space for Cgi's or PERL
Message-Id: <1998072123431500.TAA04877@ladder03.news.aol.com>

One time  fee of $15 will get you 202K block  of server space to run Perl, Cgi,
or whatever you want, looking for programmers,developers,designers, only a few
spaces available, you may buy 
2 blocks (404K) for $28
3 blocks (606K) for $40
4 blocks (808K) for $52 (you may not purchase larger than a 4 block)

The fee is good server space for one year, then if you wish to keep the space,
you get $5 off your original price the 2nd year, then an additional dollar off
each additional year (must be consecutive) eventually you would have free
server space!
808KB may not seem like much, but you can do a lot if you put all your
neccesary cgi or perl files there, then the rest of your files on a free
service like angelfire or Deamon net, almost like your own Domain, Contact
Neil128@yahoo.com to sign up for a space, Spaces sold on first come first serve


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

Date: Tue, 21 Jul 1998 18:23:19 -0400
From: mshavel@erols.com (Michael Shavel)
Subject: specific character/position in string
Message-Id: <mshavel-2107981823190001@130.9.16.207>


Hello,

I need to find out if the next to last character in a 3001 length
character string is a period (.)
There are other periods in the string that I do not care about. I don't
know what their postion is though.

I do not want to dump the whole string into an array or hash though. 
Anyone know of another way? I was thinking of substr but that function
says it will extract the substring. I need the string in tact. Just need
to know if the period is at position 3000. 

Thanks very much

Mike Shavel
mshavel@erols.com


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

Date: Tue, 21 Jul 1998 16:31:35 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: specific character/position in string
Message-Id: <MPG.101ec4b0c2a5fc12989735@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a courtesy copy sent to Michael Shavel 
<mshavel@erols.com>.]

In article <mshavel-2107981823190001@130.9.16.207> on Tue, 21 Jul 1998 
18:23:19 -0400, Michael Shavel <mshavel@erols.com> says...
> 
> Hello,
> 
> I need to find out if the next to last character in a 3001 length
> character string is a period (.)
> There are other periods in the string that I do not care about. I don't
> know what their postion is though.
> 
> I do not want to dump the whole string into an array or hash though. 
> Anyone know of another way? I was thinking of substr but that function
> says it will extract the substring. I need the string in tact. Just need
> to know if the period is at position 3000. 

You misunderstand 'extract the substring'.  Try the following:

my $x = 'x' x 2999 . '.' . 'y';
print substr($x, 2999, 1), "\n";

This will work, and $x will not be changed.

-- 
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Tue, 21 Jul 1998 18:55:56 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: specific character/position in string
Message-Id: <35B52A8C.7D94F6F6@gpu.srv.ualberta.ca>

Michael Shavel wrote:
> 
> Hello,
> 
> I need to find out if the next to last character in a 3001 length
> character string is a period (.)
> There are other periods in the string that I do not care about. I don't
> know what their postion is though.
> 
> I do not want to dump the whole string into an array or hash though.
> Anyone know of another way? I was thinking of substr but that function
> says it will extract the substring. I need the string in tact. Just need
> to know if the period is at position 3000.

substr() won't change the string unless you tell it to with
and assignment, however, you might be interested in checking
out the rindex() function which will also meet your needs.

regards
andrew


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

Date: Tue, 21 Jul 1998 20:31:45 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: specific character/position in string
Message-Id: <alecler-2107982031450001@dialup-620.hip.cam.org>

In article <MPG.101ec4b0c2a5fc12989735@nntp.hpl.hp.com>, lr@hpl.hp.com
(Larry Rosler) wrote:

> [Posted to comp.lang.perl.misc and a courtesy copy sent to Michael Shavel 
> <mshavel@erols.com>.]
> 
> In article <mshavel-2107981823190001@130.9.16.207> on Tue, 21 Jul 1998 
> 18:23:19 -0400, Michael Shavel <mshavel@erols.com> says...
> > 
> > Hello,
> > 
> > I need to find out if the next to last character in a 3001 length
> > character string is a period (.)
> > There are other periods in the string that I do not care about. I don't
> > know what their postion is though.
> > 
> > I do not want to dump the whole string into an array or hash though. 
> > Anyone know of another way? I was thinking of substr but that function
> > says it will extract the substring. I need the string in tact. Just need
> > to know if the period is at position 3000. 
> 
> You misunderstand 'extract the substring'.  Try the following:
> 
> my $x = 'x' x 2999 . '.' . 'y';
> print substr($x, 2999, 1), "\n";
> 
> This will work, and $x will not be changed.


Yes, but with

    substr($x, -2, 1)

you don't have to hardcode the position of the next-to-last character.

Andre


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

Date: 21 Jul 1998 22:41:20 GMT
From: frostps@aol.com (FrostPS)
Subject: Telnet problems with connecting to VMS sessions
Message-Id: <1998072122412000.SAA11576@ladder01.news.aol.com>

I'm trying to use the TELNET package to talk to a VMS node that is trying
to
inquire about my screen size and the like but I don't know how to respond
and eventually I
time out before I get my command line prompt. Is there options I can set to
have it
automatically respond or ignore these requests so that I can get logged in?

Scott
(Please respond to scott.frost@airtouch.com)

The output from dump_log shows:
< 0x00000: 00 1b 5b 63                                         ..[c

< 0x00000: 1b 5c 1b 5a                                         .\.Z

< 0x00000: 1b 5b 30 63                                         .[0c

< 0x00000: 0d 0a 25 53  45 54 2d 57  2d 4e 4f 54  53 45 54 2c
 ..%SET-W-NOTSET.
< 0x00010: 20 65 72 72  6f 72 20 6d  6f 64 69 66  79 69 6e 67   error
modifying
< 0x00020: 20 4e 54 59  31 31 32 3a  0d                         NTY112:.

< 0x00000: 0a 2d 53 45  54 2d 49 2d  55 4e 4b 54  45 52 4d 2c
 .-SET-I-UNKTERM.
< 0x00010: 20 75 6e 6b  6e 6f 77 6e  20 74 65 72  6d 69 6e 61   unknown
termina
< 0x00020: 6c 20 74 79  70 65 0d                               l type.

< 0x00000: 00 1b 5b 63                                         ..[c

< 0x00000: 1b 5c 1b 5a                                         .\.Z

< 0x00000: 1b 5b 30 63                                         .[0c

< 0x00000: 0d 0a 25 53  45 54 2d 57  2d 4e 4f 54  53 45 54 2c
 ..%SET-W-NOTSET.
< 0x00010: 20 65 72 72  6f 72 20 6d  6f 64 69 66  79 69 6e 67   error
modifying
< 0x00020: 20 4e 54 59  31 31 32 3a  0d                         NTY112:.

< 0x00000: 0a 2d 53 45  54 2d 49 2d  55 4e 4b 54  45 52 4d 2c
 .-SET-I-UNKTERM.
< 0x00010: 20 75 6e 6b  6e 6f 77 6e  20 74 65 72  6d 69 6e 61   unknown
termina
< 0x00020: 6c 20 74 79  70 65 0d 0a  0d 00 00 24  20           l type.....$

Here's my truss output when I log in directly from my command line:
# Here's my carriage return
read(0, "\r", 1024)           = 1
# Here's what's send to remote node
write(4, "\r\0", 2)           = 2
# Remote node must be writing back to stdout
write(1, "\r\n\r", 3)            = 3
# ? screen highlighting?
write(1, "\n1B [ H1B [ J1B [ 1 m1B".., 207)  = 207
# Now it's inquiring
write(1, "1B [ c", 3)            = 3
# Where did this come from?
read(0, "1B [ ? 1 ; 2 c", 1024)        = 7
write(4, "1B [ ? 1 ; 2 c", 7)       = 7
write(1, "1B 71B [ 2 5 5 ; 2 5 5 H".., 18)   = 18
read(0, "1B [ 2 4 ; 8 0 R", 1024)      = 8
write(4, "1B [ 2 4 ; 8 0 R", 8)        = 8
write(1, "1B >", 2)           = 2
write(1, "1B >", 2)           = 2
write(1, "1B [ c", 3)            = 3
read(0, "1B [ ? 1 ; 2 c", 1024)        = 7
write(4, "1B [ ? 1 ; 2 c", 7)       = 7
write(1, "1B 71B [ 2 5 5 ; 2 5 5 H".., 18)   = 18
read(0, "1B [ 2 4 ; 8 0 R", 1024)      = 8
write(4, "1B [ 2 4 ; 8 0 R", 8)        = 8
write(1, "1B >", 2)           = 2
# Now I finally get my prompt
write(1, "\r\n\0 $  ", 5)        = 5





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

Date: 21 Jul 1998 20:09:50 GMT
From: ostroj@gsun150.pfizer.com (Jack Ostroff)
To: hex@voicenet.com (Matt Knecht)
Subject: Re: Using splice with for
Message-Id: <6p2sie$1ub4@mascagni.pfizer.com>

[posted and emailed]

In article <4U5t1.94$dm.5926815@news3.voicenet.com>, hex@voicenet.com (Matt Knecht) writes:
> I have the need to search an array[1] for a specific element, and remove
> it.  splice seems like the natural way to accomplish this, however, I'm
> stuck with a C style for loop when trying to find the offset where I
> want to splice at.  Sample:
> 
> for (my $x = 0; $x < @array; $x++) {
>     splice(@array, $x, 1), last if $array[$x] eq 'condition';
> }
> 
What about

foreach (1..$#array) {
    splice(@array, $_, 1), last if ($array[$_] eq 'condition';
}



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

Date: 21 Jul 1998 16:57:26 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: What's wrong?
Message-Id: <m3g1fuiwpl.fsf@windlord.Stanford.EDU>

Greg Bacon <gbacon@cs.uah.edu> writes:
> jjones@nospam.elementdesign.com (j) writes:

>> #!/usr/bin/perl
>> not
>> #! /usr/bin/perl

> I read somewhere (I think of GNUish origin) that the bespaced variety of
> the shebang is more portable.  Can anyone verify or debunk this?
> Personally, I think the latter looks a little nicer (it's what I use in
> my code).

It's more portable to include a space, but the systems that require it are
obscure enough that almost no one is going to notice or care.  (I don't
remember off-hand what systems they were exactly, but I seem to recall
they were all minor branches of Unix that have long ago sunk into total
obscurity.)

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Tue, 21 Jul 1998 15:31:56 -0700
From: "Ron Feldman" <rfeldman_@_sftek.com>
Subject: which of these would be faster?
Message-Id: <6p34m1$ac@newshub.atmnet.net>

$book is a reference to a hash inside a hash of lists of lists (I think
that's what I've made is called ;->).

Before this code, I'm doing this:

###
    $x = 0;
    for (@($book->{entries}})
    {
        $x++;
    }
    print "var myArray = new makeArray($x);\n";
###

  So I already have the number of entries available to me.

Which of these loops would be faster?

###
    $y = 0;
    for (@($book->{entries}})
    {
        print "myArray[$y] = \"@{$book->{entries}}[$x]\";\n";
    }
###
or
###
    $y = 0;
    for ($z = 0; $z < $x; $z++)
    {
        print "myArray[$y] = \"@{$book->{entries}}[$x]\";\n";
        $y++;
    }
###
or
###
    $y = 0;
    for $z (1 .. ($x - 1))
    {
        print "myArray[$y] = \"@{$book->{entries}}[$x]\";\n";
        $y++;
    }
###

Thanks!




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

Date: Tue, 21 Jul 1998 19:41:17 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: which of these would be faster?
Message-Id: <alecler-2107981941170001@dialup-620.hip.cam.org>

In article <6p34m1$ac@newshub.atmnet.net>, "Ron Feldman"
<rfeldman_@_sftek.com> wrote:

[snip]

> Which of these loops would be faster?

The Benchmark module is there just for that purpose. Try it, you'll like it.

Andre


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

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


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 3219
**************************************

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