[6381] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Feb 24 18:21:52 1997

Date: Mon, 24 Feb 97 15:00:18 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 24 Feb 1997     Volume: 8 Number: 6

Today's topics:
     [BDSI] Dynamic loading perl problems (was [Pel5, BSDI,  (Dustin Andrews)
     Re: Breaking lines after n characters <dbenhur@egames.com>
     Built-in variable for loop iteration#? (Michael N. Edmonson)
     Can tied hash be stored in HOH? <kipp.e.howard@boeing.com>
     Re: Class library to make C++ more Perlish? <charltoN@illustra.com>
     Re: Class library to make C++ more Perlish? <charltoN@illustra.com>
     Executing Here doc shell commands (RMATRONE)
     Re: forward Url (Friedemann Wachsmuth)
     GDBM,Perl HP 10.10 <80crojam@menasha.com>
     Help w/ finding #define definitions <tschardt@mfg.sgi.com>
     help: syntax error for "}" (Keith Warner Colvin)
     Re: How to spam - legitimately (Lee)
     incremented scalar names, is it possible? (Tim Allison)
     Re: Making sure 'perl -v' works (Bill)
     Multiple values to/from subroutines... <jtseng@wauug.erols.com>
     Re: Multiple values to/from subroutines... <msm@iweb.net>
     Perl Script for DNS? <jquist@slip.net>
     Problems with a3 perl compiler <bpm@techapp.com>
     Simple pack problem that I can not figure out <msm@iweb.net>
     Re: split() matches, but returns no values (Bill Mitchell)
     Strange output with open function <cedar.w.milazzo@boeing.com>
     The -i switch in Win32 Perl <mpope@relay.lightspeed.net>
     Using Perl with painful or carefree style? <sami@microsoft.com>
     Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)

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

Date: Mon, 24 Feb 1997 20:33:17 GMT
From: dustin@icefog.polarnet.com (Dustin Andrews)
Subject: [BDSI] Dynamic loading perl problems (was [Pel5, BSDI, Libwww and various other critters.])
Message-Id: <2187cd$b2111.c1@PolarNet>

Vivek Khera (khera@kcilink.com) wrote:
: If you want to build a Perl 5.003 for BSD/OS 2.1, use the following
: config.sh.  The main trick is to use the system malloc library, and to
: *NOT* strip the perl binary.

: Also, you'll want to specify all the shared libs on the system as
: "extra" link  libraries in case you ever use an extension that wants
: one of them, such as the Tk extension.  The config.sh below does this
: for you.

I tried out the file that you sent and It did not work. However you
suggestions have been helping. What do you mean by Not stripping the the
perl binary? Is that an option in config that I am missing? or is is a
flag for the proccessor?

Things were going pretty well until I came up against this:

DynaLoader.o: Undefined symbol _dlopen referenced from text segment
DynaLoader.o: Undefined symbol _dlsym referenced from text segment
*** Error code 1

Any other ideas?





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

Date: Mon, 24 Feb 1997 12:00:07 -0800
From: Devin Ben-Hur <dbenhur@egames.com>
To: Luis Torres <ltorres@campus.ruv.itesm.mx>
Subject: Re: Breaking lines after n characters
Message-Id: <3311F347.577A@egames.com>

Luis Torres wrote:
>  Hello all... anyone knows how to take a really big string and break
> it into an "x" number of parts based on the number of characters on a
> line... in other less confusing words Im getting a bunch of text and I
> want to break it in many lines so it fits in a single window.

check out module Text::Wrap which does just what you want.
(Camel pg.512)
--
Devin Ben-Hur      <dbenhur@egames.com>
eGames.com, Inc.   http://www.egames.com/
eMarketing, Inc.   http://www.emarket.com/
"Don't run away. We are your friends."  O-



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

Date: 24 Feb 1997 21:46:06 GMT
From: edmonson@yulara.fccc.edu (Michael N. Edmonson)
Subject: Built-in variable for loop iteration#?
Message-Id: <5et26u$rp3@taurus.fccc.edu>

I'm wondering if there's a built-in "counter" variable somewhere in
Perl that will tell me number of the current iteration of a loop.  I
find myself writing code like:

  my $i=0;
  foreach (@array) {
    # do something with $_ and $i++
  } 

It would be nice to be able to:

  foreach (@array) {
    # do something with $_ and $LOOP_COUNTER
  } 

 ...thereby removing the need for the temporary variable.  Does such a
built-in variable exist?  "man perlvar" doesn't seem to show anything
like this.

-Michael


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

Date: Mon, 24 Feb 1997 20:31:20 GMT
From: "Kipp E. Howard" <kipp.e.howard@boeing.com>
Subject: Can tied hash be stored in HOH?
Message-Id: <3311FA98.56C8@boeing.com>

I'm creating my own tied implementation and would like to store
the tied hash in a hash of hashes.  Is this possible?

The camel says "you can bind any ordinary variable (scalar,
array, or hash) to an implementation class by using tie."
Does this mean that only $scalar, @array and %hash can be used?

Would if work if a reference to these variables were stored in a HOH?
 
Here is one of the things I would like to do:

# tie %{$self->{_Default}} MyClass::Item;   # Would this work?
tie %default MyClass::Item;                 # How about this?
self->{_Default} = \%default;


foreach $key (keys %{$self->{_Default}}) {
   # Do stuff
}

I know that I could just use %default in place of %{$self->{_Default}}
but there are a number of other places that I want to use this
type of access.  This is just a quick example of what I would like to do.

Thanks for any help.

-- 

\  Kipp E. Howard              | Voice: (206) 662-4932 Fax: (206) 662-4404   /
|\ Boeing Commercial Airplanes | Internet: keh3985@aw101.iasl.ca.boeing.com /|
|/ P.O. Box 3707, M/S 19-MH    | Stable  : kipp.e.howard@boeing.com         \|
/  Seattle, WA  98124-2207     | WWW: http://www.iasl.ca.boeing.com/~keh3985 \


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

Date: 22 Feb 1997 23:38:19 GMT
From: "Charlton Barreto" <charltoN@illustra.com>
Subject: Re: Class library to make C++ more Perlish?
Message-Id: <01bc2119$7edfb3a0$08f03a9e@transmogrifier>

Tom,

Let's understand that C++ is a 3GL which can facilitate any sort of
development, from OSs to embedded systems programming, while Perl is a
scripting language (albeit the best one out there) which is, yes, higher
level. 
So are 4GLs. So what's the point? I'll ask you this: what sort of
development takes place in C++ and what sort of development takes place in
Perl? I and
any other C/C++ developer will contend that they are not the same type.
Did you intend Perl to be flexible enough for *any* sort of software
development? Would you build an OS, real-time application, flop-intensive
program, etc., etc. in Perl? You would spend the time to build a quickie
wrapper script in C++? 

C++ is intended to provide as much flexibility and power to the developer
as is possible in a 3GL. Yes, it ends up being a 'jack-of-all-trades and
master
of none'. But the advantages to C++ among 3GLs is that you can stick to a
single
3GL to accomplish all of your needs. Is this the intent of Perl? If you
answered "no"
to either of the first two questions in the preceding paragraph, then I 
would say that this isn't the intent of Perl. It shouldn't be, of Perl or
of any other scripting language. 

> :The STL already provide associative arrays
> 
> Are they 8-bit clean?  Can you distinguish between a missing key and
> a missing value?  Do they automatically resize themselves for reasons
> of efficiency?  Can they hold arbitrary and heterogeneous objects?
> Can those objects' types be determinable and inspectable at run time?
> Do they have their memory automatically allocated and deallocated?

Yes to all. For resizing, it isn't done automatically for any associative
array
you instantiate with the STL. You have to choose to instantiate it with
resizing.

Remember, C++ is an OO 3GL designed for developers to be able to write just

about any sort of program achievable with an instructive or OO type
language (e.g., there are applications for logical type languages such as
Prolog and Lisp that aren't achievable in any type of instructive or OO
language) . As such the freedom to choose whether to utilize the default
destructors or not was left up to the developer and not the compiler (or
interpreter in Perl's case).

> Can you transparently bind them to databases, like GNU DBM or Berkeley
DB?
As Scott Maxwell wrote, not as easily as in Perl, but that a module in Perl
had to be written for it, and writing a C++ library to do the same for
C++'s set/map classes is analogous -- once the library were written (and
maybe it has been), it would be about as simple in C++ as it is already in
Perl (good job, Scott).

> Are they garbage collected? 
Nothing is garbage collected in C++. It is a 3GL that provides the choice
of
object destruction to the developer. Garbage collection would be nice
except
that there is then no way for the developer to effect when the destructors
are called. In certain situations this can result in noticable performance
degradation. Not that you'd really notice in a scripting language that is
run-time interpreted, but when you are writing a serious real-time program
or any other program where a certain speed threshold must be guaranteed you
definitely do NOT do it in any language which is run-time interpreted. 
Including run-time interpreted 3GLs. 
 
> Can you dynamically build an associative arrays of closures with deep
binding of    embedded lexical variables?
Here we go again.... why would you want Perl's implementation of deep
binding of embedded lexical variables forced upon you in a 3GL? In other
words, it can, if you want it to (and as such the answer to the question is
yes). Perl's implementation is better and involves more hand-holding. But
we get back to the fundamental issue as to whether that is appropriate for
C++.

> :and the <vector> and
> :<matrix> template classes which are far superior to the built-in Perl
> :or C-type arrays. 
> 
> I'm amazed to see anyone mention Perl arrays and C arrays in such
> a parallel construct [...rest of rant deleted]

Touchy, touchy. I presenting my view that <vector> and <matrix> beat Perl
as well as C arrays. For different reasons, of course. I'm not saying that
Perl's arrays share
the problems of C's. 

I feel that <vector>'s answer to the problems of C's arrays are more
appropriate
to 3GL development than Perl's, and in that context beat out Perl's arrays
from
an overall POV. Why? Because In the context of a scripting language and
what you would use such a language for, I wouldn't say the same thing. But
I was replying to Ben Jeffreys' original query from a 3GL context. 

Jonathan King addresses some very important issues and aspects of Perl's
three
types and Perl arrays that you should consider (good job, jking). With his
apt
arguments in mind I feel I can say that C++'s STL <vector>s are superior
from
any POV because you can implement functionality you need that *isn't*
implemented or implementable in Perl (or in C).

> :Regex pattern matching is available in the standard
> :libraries of most post-April-1995-DWP C++ compilers. 
> 
> I'll wager that the pattern matching in those libraries is a pale and
> impoverished echo of Perl's.  [...rest of rant deleted]

C++ is not a regex pattern matching wrapper. If that's what you want to 
make Perl than that's your choice. Why would it be well integrated in a
language where such control is delegated to the developer? Yes, Perl beats
out C++
in a number of the areas you mentioned (though not all). But, you have to
think a little again  to realize that putting such functionality in what
you so cheerfully call a 'low-level language' would defeat the purpose of
it. On a similar note, what about integrating native database access into a
3GL. ;-)  NOT a smart idea. Think about both situations carefully for a
while. The answer should become self-evident.

Again, I'm not saying that C++'s regex pattern matching facilities beat
Perl's. But I'm also not saying that they should, either. If they did they
would bind you to that implementation, and as any 3GL programmer will
contend, that implementation is not always appropriate for every situation
that calls for a 3GL. 

> :Perl scalars
> :are strings, so you can just use C++ string classes.
> 
> No, Perl scalar can hold strings, but they are not strings.  They are
> scalars that can transparently hold strings, numbers, or references
> and objects, all of which are automatically allocated, de-allocated,
> and garbage collected.  This is just one of the advantages of using
> a high-level language like Perl instead of a low-level one like C++.

You can implement the same functionality in C++ (it's not spoon-fed to you
as in Perl) - i.e. it can be there if you want - and you can implement it
to guarantee genericity much more easily than in Perl. And This gets back
to the purpose of 3GLs versus scripting languages, and what advantages and
disadvantages each presents to the developer.

As Scott Maxwell wrote, generic typing IS one of Perl's advantages -- and
disadvantages.  He is dead on target when he writes that in C++ you'll
never accidentally put an apple into a bag of oranges, and that it IS
easier to make this mistake in Perl.  I will disagree that it makes less of
a difference in practice 
from an overall viewpoint; IMHO Scott is correct on an individual basis.
But we
can then agree with similar arguments regarding asm. My point is that 

There are advantages as well as disadvantages to using 'high level'
languages. If high level languages were so 'superior' to 3GLs as you imply
then they would have pervasively replaced them in the fashion that 3GLs
replaced asm. And don't tell me it is due to industry factors/bias - forces
in the industry tried to hold out for asm for a long time but ultimately
failed because of the disadvantages in asm had come to outweigh the
advantages in 3GLs. This hasn't happened for scripting languages and
probably never will.

Listen, I'm not trying to disparage or deride Perl. I feel it to be the
premium among scripting languages. I, like many 3GL and 4GL programmers,
see Perl as more appropriate for certain applications and C++ more
appropriate
for others. Much of the features in Perl are nice and 'high-level', but
they
are most definitely not appropriate for certain applications. Why? We get 
back again to C/C++ and what it represents in terms of providing freedom
of choice to the developer. That's why C and C++ have pervasively cornered
the 3GL market. As I keep repeating, you can write just about any kind of
program appropriate for an instructive or OO language in C/C++. You
definitely can NOT in Perl, or any other scripting language, or Java, or
Pascal, or Fortran, or
Cobol, or Ada, APL, Forth, Eiffel, Smalltalk, etc., etc., etc. There are
going to be types of programs that these languages just cannot implement.
Show me anyone
who would write a full-blown enterprise scale application with Perl. Try
the
same w.r.t. an embedded systems program. You can't. It is just not
appropriate or
feasibly possible to do it in a run-time interpreted language. 

Again, on other hand, for most wrappers, many smaller scale programs and
for situations where performance is not a real factor, it is just as
inappropriate to
write them in C++ as opposed to Perl.

The original query involved finding a class library to make C++ more
Perl-ish
with respect to regex searching, associative arrays, and scalars. It didn't
request finding class libraries to confer the exact Perl capabilites in
C++.
It was nice to learn that libraries satisfying the latter requirement
exist,
but again, it illustrates the difference between a 'high-level' language
and
a 3GL. The developer gets to choose what they need in a 3GL because they
are
not building nice, simple little programs or wrappers in C++ - that would
be
stupid because it's far easier to do that in Perl - they are building
programs
which have to be more heavy-duty, complex and faster than anything one
would
consider with a scripting or other run-time interpreted language.

Cheers.

-Charlton.

-- 
+--------------------------------------------------------------------------+

| charlton barreto			           informix software, inc. |
| software development engineer		         1111 broadway, suite 2000 |
| charlton@informix.com			        	 oakland, ca 94607 |
|--------------------------------------------------------------------------|

| TCHAR sz[] = _T("my opinions are my own; i do not speak for informix.");
|
+--------------------------------------------------------------------------+


-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GM/CS d---(d-) s+:s a? C++++$ U++++$ P++++$ L++++ E+++(---) W++++
N++++ o+++ !K w+++++$$ O+++$ M---(M+++)<$ V---(V+++)<$ Y+++ PGP++
t* 5 X++ R+++ tv b++++ DI++++ D+++ G++++ e+++ h++* r+++ z*
------END GEEK CODE BLOCK------





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

Date: 22 Feb 1997 22:36:40 GMT
From: "Charlton Barreto" <charltoN@illustra.com>
Subject: Re: Class library to make C++ more Perlish?
Message-Id: <01bc2110$e22e9bf0$0ef03a9e@transmogrifier>

At 02:19 PM 2/20/97 +0100, you wrote:
>Come on. The only feature that require OS support is the globbing like
><*.c>. That's all. All the regex features are built-in.

No. Not all. And NONE of the sed/awk functionality is built in. ROTFL, 
as you so cheerfully say....

>ROTFL. And what do you supposed your library routines in C/C++ ? When you
>do I/O for example ? They called read(2)/write(2)/lseek(2). Wait, there
are
>system calls, aren't they ?
>
>Please don't try to confuse the issue.

Seems like you need to attain a better understanding of C/C++ and 3GLs in
general. C/C++ library routines are NOT (nor do they use) system calls.
They don't have to go 'through' the OS in the sense that system calls do.
They are implemented specifically for the OS, though. And it isn't that
confusing - if you have a fair understanding of 3GLs. I'm not going to
explain here since this is covered in most fundamental C/C++ texts.

> PS: please cut down your sig . to 4 lines, no one care about Geek code or
> such or fancy boxes. Thanks,

It seems like you do....

Cheers,

-Charlton.
-- 
+--------------------------------------------------------------------------+

| charlton barreto			           informix software, inc. |
| software development engineer		         1111 broadway, suite 2000 |
| charlton@informix.com			        	 oakland, ca 94607 |
|--------------------------------------------------------------------------|

| TCHAR sz[] = _T("my opinions are my own; i do not speak for informix.");
|
+--------------------------------------------------------------------------+


-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GM/CS d---(d-) s+:s a? C++++$ U++++$ P++++$ L++++ E+++(---) W++++
N++++ o+++ !K w+++++$$ O+++$ M---(M+++)<$ V---(V+++)<$ Y+++ PGP++
t* 5 X++ R+++ tv b++++ DI++++ D+++ G++++ e+++ h++* r+++ z*
------END GEEK CODE BLOCK------



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

Date: 24 Feb 1997 21:42:33 GMT
From: Rmatrone@cris.com (RMATRONE)
Subject: Executing Here doc shell commands
Message-Id: <5et209$4vk@chronicle.concentric.net>

Within a shell script I can do here-docs to execute a
multi-lined command script without the need to create a separate file to
hold and invoke. Would like to see an example of how this could/should
be applied in perl.

For example, execute this within a perl program,so  I can capture
and manipulate the output:



 
sqlplus -S ai/aisat8110 << _SELECT_STATUS > $BUSY

set heading on
set numwidth 2
column ACTIVE_SCAUDF heading SC
column ACTIVE_GAUDF  heading GA
column ACTIVE_CKNSN  heading CK
column ACTIVE_MKUDF  heading MK
column ACTIVE_CVERT  heading CV
column ACTIVE_JMX    heading JX
select ACTIVE_SCAUDF, ACTIVE_GAUDF, ACTIVE_CKNSN,
       ACTIVE_MKUDF,  ACTIVE_CVERT, ACTIVE_JMX
from aiparms;
_SELECT_STATUS





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

Date: Mon, 24 Feb 1997 19:57:37 +0100
From: friedemann.wachsmuth@on-line.de (Friedemann Wachsmuth)
Subject: Re: forward Url
Message-Id: <19970224195737833340@dip121-1.hamburg.on-line.de>

Russ Verner <russ@eastland.net> wrote:

> I was looking for a cgi script that would let you forward someone to a new
> url.  I plan to use a drop box for a pick list and from the user input then
> send them to another url.  All I need is the part to auto forward someone.

---- schnips --------------------------------------- 
#!/usr/bin/perl

$gew = $ENV{'QUERY_STRING'};

($void,$weiter) = split (/=/,$gew, 2);
($weiter,$dummy) = split (/&/,$weiter, 2);

$weiter =~ s/W.*//;
$weiter =~ tr/A-Z/a-z/;
$weiter = "../" . $weiter . ".html";

print "Status: 302 Found\n";
print "Location: " . $weiter . "\n";
print "URl: <" . $weiter . ">\n";
print "Content-type: text/html\n\n"; 
---- schnips --------------------------------------- 

If the Menu-Item is 'Russ' the cgi will fwd you to "../russ.html".

Peaceman


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

Date: 24 Feb 1997 22:29:00 GMT
From: "James B. Crocker" <80crojam@menasha.com>
Subject: GDBM,Perl HP 10.10
Message-Id: <01bc22a1$fc0e35c0$4414b7cd@mx55.205.183.20.67>

I've gotten gdbm-1.7.3 to compile and install without incident. I've gotten
perl-5.003 to compile and install without incident on an HP 10.10 box. The
configure says that 
ndbm, dbm etc are OK. However when it loads up the gdbm.h it complains:

<gdbm.h> found.
gdbm_open() NOT found.
We won't be including <gdbm.h>  

Looking at the gdbm.h file it lists gdbm_open? What might be going on here?
Anyone else come across this as an issue?
-- 
James B. Crocker
I.S. Technical Services - Webmaster
Menasha Corporation
80crojam@menasha.com


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

Date: Mon, 24 Feb 1997 13:13:03 -0800
From: Timothy Schardt <tschardt@mfg.sgi.com>
Subject: Help w/ finding #define definitions
Message-Id: <3312045F.41C6@mfg.sgi.com>

Hello all,


  PLEASE HELP


  What is the easiest way to do the following in perl ?


  Sample input file
  -------------------------------------------------------
  #define Define1    \t  "This is my define" \  \t \n
                    " that spans" \t \ \n
                    " multilines" \n

  #define PI         3.14159
  #define Define2( x )    (x << 7) * \ \n
                     PI \n
                     
  -------------------------------------------------------
 
  I want to use an associated array to find the definition
  of a #define to have the results of the above sample
  file be:

  DefineArray{ "Define1"      } = 
      "This is my define"" that spans"" multilines";

  DefineArray{ "PI"           } = 3.14159;

  DefineArray{ "Define2( x )" } = (x << 7) * PI;


  I think a generic way to find the definition of a #define
  would be useful.

  Any help would be greatly appreciated.

  Thanks,
    Tim


-- 

 Another small fluke in life that I get.
 Give it to Tim, he likes it ;-)


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

Date: Mon, 24 Feb 1997 11:36:30 -1000
From: colvin@aloha.net (Keith Warner Colvin)
Subject: help: syntax error for "}"
Message-Id: <colvin-2402971136300001@hawaii-103.u.aloha.net>

Aloha from Hawai'i,

I am trying to run a .cgi, and I get these error messages, 
I have tried a number of things, what is the advice of you who know more?


# Unmatched right bracket, at end of line
 Line 140
# syntax error, near "}"
 Line 140
# aborted due to compilation errors.

Mahalo for your time,
kc.


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

Date: Mon, 24 Feb 1997 21:38:31 GMT
From: DeathToSpam@dev.null.com (Lee)
Subject: Re: How to spam - legitimately
Message-Id: <33120918.172018446@news.earthlink.net>

Unlike many other languages English is extremely dynamic and growing
at a radical rate.  Presently it is the largest language in size of
all known languages in the world...over 1 million words.

So is email a word?  Yes, because it has been accepted by a majority
of users as such.  Unlike British English, French and other languages
that maintain a language police, the english the rest of the world
depends upon is truly democratic in the choice of words.

carroll@tjc.com (Terry Carroll) wrote:

@>-->---On 22 Feb 1997 05:09:42 GMT, Tom Christiansen
<tchrist@mox.perl.com>
@>-->---wrote:
@>-->---
@>-->---> [courtesy cc of this posting sent to cited author via email]
@>-->--->
@>-->--->In comp.lang.perl.misc, Valdis Kletnieks
<valdis.kletnieks@vt.edu> writes:
@>-->--->:> All of these emails will be different based on user
preferences.
@>-->--->:Well.. if you have 18,000 different emails, 
@>-->--->
@>-->--->Why does this sound wrong to my ear?
@>-->---
@>-->---Because you haven't noticed the adaption of the English
language?
@>-->---
@>-->---It's pretty common now to hear "email" as a noun.  "eletter"
would be an
@>-->---abomination.
@>-->---
@>-->---
@>-->-----
@>-->---Terry Carroll       | "Al Gore is doing for the federal
government what
@>-->---Santa Clara, CA     | he did for the Macarena.  He's removing
all the
@>-->---carroll@tjc.com     | unnecessary steps."
@>-->---Modell delenda est  |                - Bill Clinton, September
20, 1996

--Lee

Internet/Intranet Counsulting and Design:
http://www.designwest.com
Nurses' Call:
http://www.nurse.org/Nurses_Call/


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

Date: Mon, 24 Feb 1997 21:51:16 GMT
From: tja2f@dayhoff.med.Virginia.EDU (Tim Allison)
Subject: incremented scalar names, is it possible?
Message-Id: <E64nDG.9p8@murdoch.acc.Virginia.EDU>


I've looked through my new Camel book but to no avail...

First a braod overview of what I'm trying to accomplish:
I'm grepping a variable # of lines ( about 10-30) from each of about 500
files.  I want to then format the output of those lines (keeping the
text itself the same but changing the output order of the lines).  I
will also be splitting the lines later, but that's a separate issue.

So, what I'd like to do is 


format OUT =
 ...
 .


open a list of filenames;

while <FILELIST>  {
	assign each grepped line to a scalar;
}

write OUT;

so that I don't have to assign 500*30 scalars, I'd like to use scalar
names of the form:  ##name## where the first ## is the ## of the file
and the second ## is the relative # of the grepped line.  [For example,
23name13 would be the 13th grepped line from the 23rd file.]  I am
absolutely flexible on this; but is this even possible?  How can I :

$i = 1;

in the while loop:
	$i = $i++;  
	$iname01 = $grep[0];
	$iname02 = $grep[1];

and so on but such that the "i" in iname gets replaced at each cycle of
the loop???  Or whatever other means would work.

[Ultimately, 'grep "blahblahblah" *.xyz |sort -lots_of_funky_sort_keys'
might do the job but as I'll need to deal with the contents later, I'm
hoping there's a way to do this.]


I hope that this made sense and will me most appreciative of any help,
thank you,

Tim Allison
tja2f@potto.bioch.virginia.edu
Univ. of Virginia
Dept. of Biochemistry





-- 
--------------------------------------------------------------
Tim Allison				Dept of Biochemistry
tja2f@dayhoff.med.virginia.edu		University of Virginia


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

Date: 24 Feb 1997 21:42:48 GMT
From: bill@sover.net.no.junkmail (Bill)
Subject: Re: Making sure 'perl -v' works
Message-Id: <slrn5h42qo.298.bill@granite.sover.net>

In article <01bc1f20$60ae9540$7ce42ac2@steve>, "Stephen K. Bohler" wrote:
>I've just tried to determine the version of Perl running on my client's
>server and it tells me that it is version 4. However, they have the
>/usr/local/lib/perl5 libraries on it.
>
>I told them they don't have the current version of the Perl interpreter, so
>they told me to try an ISP server they are borrowing as well. Again, the
>same results.
>
>Before I tell them they've got to get the latest and greatest Perl
>interpreter, I want to make sure that 'perl -v' is being accurate. I don't
>understand how they have the proper libraries, but have an out-of-date
>interpreter.
>
>Can anyone explain this discrepancy?
>
>Thanks so much in advance.
>------------------- 
>Stephen Bohler
>Oxford
>United Kingdom

   Look for a binary called "perl5".  I've seen ISP's that encourage the 
use of Perl 4 but also have Perl 5 available for those that really want it.

						Bill
-- 
Sending me unsolicited email through mass emailing about a product or
service your company sells ensures that I will never buy or recommend your
product or service.



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

Date: Mon, 24 Feb 1997 16:17:04 -0500
From: Joe Tseng <jtseng@wauug.erols.com>
Subject: Multiple values to/from subroutines...
Message-Id: <Pine.LNX.3.95.970224161241.559A-100000@wauug.erols.com>

I know that you can pass out a single value from a subroutine.  But I
would like to know if it's possible to generate multiple values from one
subroutine and pass it to another?  I guess you can disperse return
statements within the 1st subroutine...

(I looked in my turquoise Camel book and found no reference to this
matter.  Somehow I kinda like the pink Camel book better...)


Joe Tseng
(301)523-4877
mailto:jtseng@wauug.erols.com | http://206.136.44.4/

unzip ; touch ; finger ; mount ; gasp ; yes ; umount ; sleep
#16 Terrapins Basketball (20-7) -- They're fading fast.........
Friends don't let friends become Orioles fans!  GO YANKEES!!!!!



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

Date: Mon, 24 Feb 1997 16:19:24 -0500
From: Mike Mitchell <msm@iweb.net>
Subject: Re: Multiple values to/from subroutines...
Message-Id: <331205DC.2641@iweb.net>

return ($one,$two,$three);

or 

return (@numbers);

Mike


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

Date: Mon, 24 Feb 1997 13:53:59 -0800
From: Jonathan Quist <jquist@slip.net>
Subject: Perl Script for DNS?
Message-Id: <33120DF7.5590@slip.net>

I'm looking for a script to help maintain my DNS database. Any
recommendations?


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

Date: 24 Feb 1997 15:46:04 -0600
From: Brian P Millett <bpm@techapp.com>
Subject: Problems with a3 perl compiler
Message-Id: <vksp2landv.fsf@terraweb.com>

Hello, I've got perl5.003 with the op.c patch, the Compiler-a3, all
installed and compiled.  I try to compile the following perl code (at
bottom) with the following encantation:
"perl -Iblib/arch -MO=C,-ofortune.c fortune.pl"
and get the following errors:

vlad: perl -Iblib/arch -MO=C,-ofortune.c fortune.pl
Bad free() ignored at /opt/gnu/lib/perl5/site_perl/B/C.pm line 60.
fortune.pl syntax OK
Can't use an undefined value as a symbol reference at /opt/gnu/lib/perl5/site_perl/B/C.pm line 65.
END failed--cleanup aborted.

The bytecode works fine, but not -MO=C or -MO=CC.  Any ideas?

Thanks
---------
#!/opt/gnu/bin/perl
open(STUFF, "/usr/local/lib/fortunes.dat") || die "Can't open fortunes: $!\n";

srand (time|$$);
rand(644280);
$file_position = int (rand(644280)) + 1;
#	 print "Rand = $file_position\n"; 
seek(STUFF, $file_position,0);

do {
  $_ = <STUFF>;
  #	   print $_;
} until $_ eq "%\n";

for (;;) {
  $_ = <STUFF>;
  last if $_ eq "%\n";
  print $_;
}

close STUFF;

1;
------------
-- 
Brian Millett                    
Technology Applications Inc.     "Heaven can not exist,
(314) 530-1981                          If the family is not eternal"
bpm@techapp.com                   F. Ballard Washburn


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

Date: Mon, 24 Feb 1997 16:17:47 -0500
From: Mike Mitchell <msm@iweb.net>
Subject: Simple pack problem that I can not figure out
Message-Id: <3312057B.3A4F@iweb.net>

Hi all,

I have a 24 bit coded string like:

"11111111000000000000000000"

I am trying to get the decimal equiv for this number (convert from
binary to unsigned integer). And to go the other way too!

I have been messing around with pack and I can't seem to get it to work
right - which is probably because I have yet to fully understand pack.

Help please.

Thanks in advance.
Mike


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

Date: 24 Feb 1997 20:44:40 GMT
From: mitchell@leadbelly.math.ufl.edu (Bill Mitchell)
Subject: Re: split() matches, but returns no values
Message-Id: <MITCHELL.97Feb24154440@leadbelly.math.ufl.edu>

In article <3310D483.39F3@egames.com> Devin Ben-Hur <dbenhur@egames.com> writes:
> without LIMIT trims trailing null fields) is correct.
> 
> Here's two simple solutions to get all the fields without 
> knowing how many there are ahead of time:
>   @res = split(/:/, $str . ':x');	# add some junk to end
>   pop @res;	# throwaway the last field
> 
> this might be faster:
>   @res = split(/:/, $str, ($str=~tr/://)+1 );
> 


Why not just this,
    @res = split(/:/, $str, 10000)
assuming that _some_ upper bound on the number of fields is known?
--
    Bill Mitchell
    Dept of Mathematics,        The University of Florida
    PO Box 118105, Gainesville, FL 32611--8105
    mitchell@math.ufl.edu	(352) 392-0281 x284

  


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

Date: Mon, 24 Feb 1997 20:06:46 GMT
From: Cedar Milazzo <cedar.w.milazzo@boeing.com>
Subject: Strange output with open function
Message-Id: <3311F4D6.41B9@boeing.com>

I am trying to override the open function to prepend a path to any file
opened.  I am getting very strange output though.  
When I run the code below I get:

FILEHANDLE=TEST
EXPR=Can't locate object method "open" via package "Filehandle at
topen.pl line 17.

Code used is:

use subs 'open';

open(TEST,testfile);
print (TEST "testing" );
close(TEST);

sub open {
  my($FILEHANDLE,$EXPR)=@_;
  print("\n FILEHANDLE=");
  print($FILEHANDLE);
  if ($EXPR){
  print("\n EXPR=");
     print($EXPR);
  }
  CORE:open TEST testfile;
  print(TEST "\n\nThats all.\n");
  close(TEST);
  return 1;
}

Any suggestions would be greatly appreciated.


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

Date: Mon, 24 Feb 1997 13:08:03 -0800
From: Milton Pope <mpope@relay.lightspeed.net>
Subject: The -i switch in Win32 Perl
Message-Id: <33120333.2FEC@relay.lightspeed.net>

When I use the -i edit-in-place switch in Win95, the backups get made, 
but the original files are all truncated to 0 bytes.  Is there a way 
around this?

Example:
  perl -p -i.bak -e "s/A/a/;" *.txt

This creates a set of files named, for instance, file1.txt.bak, etc., 
but the file file1.txt contains 0 bytes, as to the rest of the *.txt 
files.

--Milton--




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

Date: 24 Feb 1997 20:59:48 GMT
From: "Sam Inala" <sami@microsoft.com>
Subject: Using Perl with painful or carefree style?
Message-Id: <01bc2295$a3e6ba90$928d389d@miyu>


I recently read an article by Larry Wall in the _Linux_ magazine.
In it, he describes Perl as a language which may be used in
multiple styles. You may use it to write quick and dirty scripts, 
or you can be a somber, serious software engineer, and 
use -w, use strict, and include function prototypes.

I must enjoy pain. I have always used these even for the
shortest scripts. To my mind, such features always save time.
Not using them simply asks for hidden problems. Are there
people out there who actually practice both a carefree
style and a somber style? Or is it that Perl may be used
by two kinds of programmers, the fastidious ones and
(dare I say it) the sloppy ones?

-- 
The opinions expressed in this message are my own personal views 
and do not reflect the official views of Microsoft Corporation


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

Date: 8 Jan 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Jan 97)
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.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.

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 6
***********************************

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