[12107] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5707 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 18 00:07:13 1999

Date: Mon, 17 May 99 21:00:15 -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           Mon, 17 May 1999     Volume: 8 Number: 5707

Today's topics:
    Re: Bandwidth [Was: Re: man pages and FAQs: why posted? (John Stanley)
    Re: dynamic loading problem (Martien Verbruggen)
    Re: Error message when reading a file (Tad McClellan)
    Re: FAQ 4.15: How do I find yesterday's date? (John Stanley)
    Re: how to read in line by line? (Tad McClellan)
    Re: man pages and FAQs: why posted? lvirden@cas.org
    Re: OOP and Perl-a good book? (Randal L. Schwartz)
    Re: Perl "constructors" armchair@my-dejanews.com
    Re: Perl "constructors" armchair@my-dejanews.com
        Please Help:My script runs on win32, it won't run on Un <Lazer@global.co.za>
        Randon hex #'s, directory contents, and password questi <portboy@home.com>
    Re: Sorting my list... tbsmith@deltacom.net
    Re: Sorting problem (Randal L. Schwartz)
    Re: Using split with map, then join tbsmith@deltacom.net
        Where to start [Was: Re: perldoc question lvirden@cas.org
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 18 May 1999 03:17:10 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Bandwidth [Was: Re: man pages and FAQs: why posted?
Message-Id: <7hqm3m$8il$1@news.NERO.NET>

In article <7hqgh1$bkh$1@srv38s4u.cas.org>,  <lvirden@cas.org> wrote:
>in this group... So if the bandwidth is going to be used anyways, it might
>as well be used on something like the FAQs.

Invalid assumption.

The bandwidth isn't going to be "used anyways". People who post to alt
groups do not measure what has been posted to clpm to see how much they
can post, nor does the bandwidth of my systems get used transporting
alt.binaries if there isn't anything in clpm to send. 



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

Date: Tue, 18 May 1999 03:14:05 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: dynamic loading problem
Message-Id: <1W403.156$Kq5.1102@nswpull.telstra.net>

In article <373ebd38.13327641@news.mindspring.com>,
	Chen Lim writes:

> I tried to rebuild my perl to configure dynamic loading. I got this
> message when I run "sh Configure". "The bundled C compiler can not
> produce shared libraries so you will not be able to use dynamic
> loading."
> 
> Any suggestion on how I should this problem ? Is there a work around

- make sure you have an operating system that supports shared
  libraries (you fail to mention your current one)
- get a C compiler that does support the building of shared libraries
  if none comes shipped with your OS. gcc is excellent and freely
  available.

> to make dynamic loading work on my system ? And how do I statically
> linked the module tomy script ?

Hmmm. It's a long long time ago that I last had to statically link
stuff into the perl executable. You have to recompile the original
source tree with your stuff somewhere added in. I believe you tell
Configure about it. It's really been too long ago for me to remember.
I am sure you can read the documentation that comes with perl as well
as I can, so I won't do it for you. Start with the INSTALL file in the
distribution. It may have some pointers for you.

But I would really consider making sure you have an OS and a compiler
that allow you to use dynamic libraries.

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | Think of the average person. Half of
Commercial Dynamics Pty. Ltd.       | the people out there are dumber.
NSW, Australia                      | 


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

Date: Mon, 17 May 1999 14:53:48 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Error message when reading a file
Message-Id: <sjoph7.9p8.ln@magna.metronet.com>

Dick Latshaw (latsharj@my-dejanews.com) wrote:
: In article <7hpv41$qa$1@nnrp1.deja.com>,
:   tcpeter@my-dejanews.com wrote:
: > And a '..' !  So the error is that I'm trying to read a directory as
: > though it were a file?!?  *That's* what is giving me the error, right?
: > I'm assuming I need to filter that "filehandle" out before attempting
: > to read the contents of the files, correct?

: Correct!  Readdir gives you a directory listing, including . , .., and
: any subdirectories. Next take a look at: for my $filename (<*>) {


   Suggesting that someone change from opendir/grep/readdir to
   file globs is not good advice.


   File globs are bad because:

      1) they are slow

      2) they are less portable

      3) they have only weak pattern matching

      4) they are space-limited (this is imposed by the shell that
         perl uses to do the globbing)


   If the original poster wants only files, ignoring all of the other
   types of filesystem objects, then this will work faster, more
   portably, and with very large lists of files:


      foreach my $filename ( grep -f, readdir(DIR)) {


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 18 May 1999 03:12:34 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: FAQ 4.15: How do I find yesterday's date?
Message-Id: <7hqlr2$8dd$1@news.NERO.NET>

In article <3740b51f.0@usenet.fccj.cc.fl.us>, Bill Jones <bill@fccj.org> wrote:
>In article <7hq60v$s59$1@news.NERO.NET>, stanley@skyking.OCE.ORST.EDU (John
>Stanley) wrote:
>> Except that 24*60*60 isn't always "one day", and thus can give the wrong
>
>I am too lazy to look at DejaNews again...

I hope you never tell someone that THEY should go look in DejaNews for
an answer to something they ask here in this group. 

>Pray tell, when isn't there 60 seconds in
>each of the 60 minutes which, as a group,
>each make up 24 hours in a 'normal day'?

When the day is 23 or 25 hours long. 

>Trying to pull a "There is really only 23:59:58 in
>a day doesn't count..."

Don't tell me what I am trying to pull until you do the work to answer
your question by looking at the discussion that has taken place in this
group so many times before.

>Or, if you prefer, we could go off on the
>There is really only 360 business days in a
>year - those others are thrown out..."

You can go off on whatever you want. 



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

Date: Mon, 17 May 1999 14:42:14 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: how to read in line by line?
Message-Id: <6unph7.9p8.ln@magna.metronet.com>

Yang Chao (yangc@ra.comm.mot.com) wrote:
: This is a multi-part message in MIME format.
                                  ^^^^^^^^^^^


   Please configure your "newsreader" correctly.

   Usenet is a text-only medium. MIME doesn't belong here.


:   I am trying to write a piece of perl script to process a file.
: I want to open a file and then read from it line by line.


   The first example given in the description for open() in
   perlfunc.pod shows how to do that.


: I am trying to use the following perl script, but it seems
: it only read in one line out of every two lines.


   No, it reads every line.

   Your code discards every other line though.




:   while (<IN>){


   Read a line. Put it into the $_ special variable, never to be used...


:         $line = <IN>;

   Read *another* line. Process this one...


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 18 May 1999 01:54:02 GMT
From: lvirden@cas.org
Subject: Re: man pages and FAQs: why posted?
Message-Id: <7hqh7q$c3g$1@srv38s4u.cas.org>


According to John Stanley <stanley@skyking.OCE.ORST.EDU>:
:Untrue. Until the installed perl system starts updating the
:documentation automatically from the posted man pages, it will be
:neither push nor pull, just "fling". 

It was my understanding that the pages posted come from the source
distribution's documentation - so the doc was updated before it was posted.

I agree though that this model isn't push - which implys sending info
to people who've requested it.  It's more like 'publish' ...
-- 
<URL: mailto:lvirden@cas.org> Quote: Saving the world before bedtime.
<*> O- <URL: http://www.purl.org/NET/lvirden/>
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.


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

Date: 17 May 1999 20:40:03 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: OOP and Perl-a good book?
Message-Id: <m1r9ofm4fg.fsf@halfdome.holdit.com>

>>>>> "Damian" == Damian Conway <damian@cs.monash.edu.au> writes:

Damian> "%GIVEN NAME% o'regan" <"%GIVEN NAME%.o'regan"@port.ac.uk> writes:
>> Would any be able recommend a good book that addresses OO in Perl
>> comprehensively?

Damian> I have written such a book. It will be published by Manning
Damian> Publications in August this year. See
Damian> http://www.manning.com/Conway/.

And it's a darn excellent book as well.  (I'm one of the reviewers.)
I am looking forward to the day that I can refer all my students to it.

Damian> Not much help right now, I realize :-)

That's life. :)

-- 
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, 18 May 1999 03:17:05 GMT
From: armchair@my-dejanews.com
Subject: Re: Perl "constructors"
Message-Id: <7hqm3h$gej$1@nnrp1.deja.com>

In article <7hp5o4$dko$1@nnrp1.deja.com>,
  John Porter <jdporter@my-dejanews.com> wrote:
> In article <7hlu8v$bl9$1@nnrp1.deja.com>,
>   armchair@my-dejanews.com wrote:
> > Maybe agreement isn't the right word, but I certainly
> > have gotten lots
> > of positive feedback.
>
> Really?  The most positive thing I could say about your unwarranted
> complaints about Perl is: you do well to think critically about the
> design of the language, but eventually you'll see why the decisions
> were made the way they were.

Thanks, on balance I think we are definitely dealing with a positive
number.

>
> > >  my $self = {};
> > >  $self->{ref1} = { foo => 10, bar => 20 };
> > >  $self->{ref2} = { this => 10, that => 20 };
> >
> > That is one reference per object. $self.  I am aware that you can
have
> > that reference point to a data structure, which in turn can hold
> > references to other data structures.
>
> And how is this different from C++ exactly?
> (Answer: It's not.
>
>   p = new SomeStruct;
>   p->ptr1 = new Foo( 10, 20 );
>   p->ptr2 = new That( 10, 20 );

The difference is that p is a pointer to a struct, and Perl has no
structs (records). And yet is has something that is only a special
symbol away from being one as I illustrated elsewhere:

my #time_record
( $sec,
  $min,
  $hour,
  $mday,
  $mon,
  $year,
  $wday,
  $yday,
  $isdst
)           = localtime(time);


And just what is the big horrid taboo about records? What is so
outrageous about the concept? What would happen to Perl programmers if
you had
my ^record ( $name, $address, $city, $state, $zip, $ref_other ); in the
language? Would they all say the language is no longer usable and try
something else?

>
> > My major complaint ... is that one variable can at one
> > moment hold a number, and another moment hold a string (not to
> > mention references).
>
> It helps to think of all scalars as being strings, with built-in
> automatic conversion operators to/from other types.  (That's not
really
> the way it is under the hood, but for now, it's a workable analogy.)
>
> Maybe you don't relish the idea of all your numbers being stored
> as strings, and getting converted -- a costly operation -- to an
> integer or float each time you use it.  That's why Perl caches the
> result of the conversion.  And this cached conversion works both
> ways:
>
> 	$n = $x + 5;    # a number
> 	print $n;       # convert to string
> 	$s = "$n zots"; # use the cached string value again


If I followed your description, it seems the comments would be
$n = $x + 5; # convert string to number add 5, convert number to string
             # assign to other string
print $n;    # print string
$s = "$n zots"; # combine string var with string literal,
                # assign result to string
>
> As far as buying the programmer something: the mere fact that I don't
> have to worry about different types of scalar values is one load
> off my mind.  I never have to worry about different numeric
> representations (single, double, short, long...), nor about string
> memory allocations and overruns.  From the Perl perspective, the
> distinction between these different types of scalars is artificial
> and unnecessary.

I am not looking for a separate type for short, int, double, just one
that holds numeric values.
What technique do you use to validate that the $var you as being passed
is actually a numeric value?

>
> > "One of the ideas I keep stressing in the design of Perl is
> > that things that ARE different should LOOK different."
>
> It's all in how you understand the work "LOOK".
> You can't do this and expect sensible results:
>
> 	$n = 5;  # a number
> 	$n->();  # deref as a function reference?

                 # deref method of an object?

I am not sure how showing me code that illustrates how dollar sign does
not differentiate the type of the variable, helps your case.

>
> You can't even do this:
>
> 	$r = [ 5, 9 ]; # an array ref
> 	$r->{'foo'};   # deref as a hash reference?
>
> perl (the interpreter) is far more concerned with the types of the
> *values* than the types of any things which hold values.

It's concerned enough to require you to explicitly specify the "type" as
a prefix to every variable both at declaration and at every usage. And
of course I am not complaining about that explicit differentiation, and
will even praise it. But, the $ type symbol is obviously ambiguous -
string? number? reference to another variable?

>
> --
> John Porter
> Put it on a plate, son.  You'll enjoy it more.
>
> --== Sent via Deja.com http://www.deja.com/ ==--
> ---Share what you know. Learn what you don't.---
>


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Tue, 18 May 1999 03:38:30 GMT
From: armchair@my-dejanews.com
Subject: Re: Perl "constructors"
Message-Id: <7hqnbn$h7m$1@nnrp1.deja.com>

In article <7hp2fa$bj9$1@nnrp1.deja.com>,
  John Porter <jdporter@min.net> wrote:
> In article <7hippv$8j0$1@nnrp1.deja.com>,
>   armchair@my-dejanews.com wrote:
>
> As I understand it, what you are proposing is that perl disallow
> any method from returning a blessed lexical except those whose
> name is in some special set (i.e. either 'new', or the final
> element of the class path name* -- you haven't said which).

I said "new", but I think the same name as the Module/Class would
actually be better. But since Perl does not have what C++ calls
"function overloads" where the same name can be used for different
functions, who each differ by input parameter types - having only one
allowable name for a constructor would preclude having multiple
constructors of an object. I can see where that would be undesirable. So
I wouldn't propose any restriction on the constructor name unless Perl
supported two methods of the same name.

>
> But this is a bogus restriction that makes life worse for Perl
> programmers while adding nothing of any benefit to anyone else.

I think there is some benefit to be looking at code and instantly see
that a method is a constructor, or not.

>
> > And since C++ is
> > used for major projects, whereas Perl is used on more "quick and
> dirty"
> > small projects, I am very surprised that you would feel that the
Perl
> > way is the right way.
>
> "Right" is only meaningful in context.  When you're programming
> in Perl, the Perl way *is* the right way. At least, "more right" than
> the way of some alien language.

I would agree that "right" is a matter of opinion in many things,
including this.

>
> The size of the projects on which Perl is used is irrelevant.

I am using size of the project to try and amplify a value or benefit.
If I recommended you use a squeegee to clean your windshielf, you would
laugh and say "I've been using a paper towel just fine for years and
so have all my friends". And that's true, with one windshield cleaning
a month, the benefit of a squeegee is negligible. But when you are
assigned the task of cleaning the entire companies windshields, the
benefit of a squeegee starts to become significant.

>
> > It is much easier to work with discrete variables rather than
> > subscripted array variables. I can remember that total_attendees is
> the
> > number of peope who attended the meeting a lot easier than I can
> > $rSelf->[10] is.
>
> Apparently you're not familiar with the (far more common) hash
> object style:  $rSelf->{'total_attendees'}.

You aren't the only one who didn't go back up and edit based on what he
later read.

>
> > I have not run into any brick wall,
>
> Then your argument is merely academic.
> Perl doesn't respect academic arguments.
> Perl gets real work done in the real world.
> That its design philosophy!  Perl is Practical.

You write "Perl doesn't respect academic arguments".
Can you please define Perl as used in your statement.

>
> > but having worked
> > with C++, I can assure you that having only one reference in an
object
> > point to its data (none of which is a struct or true
multi-dimensional
> > array) does not lead to a great convenience in programming.
>
> As a professional Perl programmer, I can assure you that it does
> indeed lead to great convenience.  Based on my own personal
> experiences.  This carries rather more weight with me that your
> "assurances", which seem to be based on nothing more than some
> familiarity with a kludgy half-baked OOPL wannabe.  Not that Perl
> is Smalltalk or Eiffel, but C++ isn't either.  You need to get past
> the biases you bring from other languages, and understand Perl
> for what it is.  The similarity of the syntax is misleading; Perl
> is really nothing like C++, and any expectations that it is are
> bound to lead to frustration.

As a Perl advocate, I would refrain from using the phrase "kludgy
half-baked OOPL wannabe".
Perl has some real pluses versus C. Strings, dynamic arrays, dynamic
"hashes". The programmer doesn't have to worry about memory allocation
or deallocation. And I will give credit for the type of a variable being
semi-conveyed in variable names (I have discussed the ambiguity of $
before). And Perl has objects. Which leads to a good point - Perl has
not always had objects. So, presumably, at one point in the not so
distant past, someone said "hey, Perl should have objects" at which
point I would have to guess that there was a chorus of - "you don't need
objects, objects don't buy you anything, don't put your box on Perl,
think the Perl way, you're not smart enough for Perl, go use a language
other than Perl."  And yet.... now Perl has objects.



--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Sat, 15 May 1999 23:47:28 +0200
From: Lazer <Lazer@global.co.za>
Subject: Please Help:My script runs on win32, it won't run on Unix
Message-Id: <373DEB6F.6F48F795@global.co.za>

Hi,
I have written a perl script based on a tutorial which I downloaded, in
this tutorial, the author suggested i use win32 (Activeperl) to debug my
perl scripts. The script runs without any glitches on a windows-based
system. When I try it on a unix server, it just returns an error message
- I do not have access to the log files, so i can't get any more
information than that.

Does anyone have any ideas as to why it won't run, or is there any Url
where i can see the dfferences(or how to modify a script for unix)?

Thanx

Warren
(Lazersa@hotmail.com)



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

Date: Tue, 18 May 1999 03:10:59 GMT
From: Mitch <portboy@home.com>
Subject: Randon hex #'s, directory contents, and password questions...
Message-Id: <3740DABA.CA11D457@home.com>

Here's some questions I have:

1.)  I need to prompt the user for a password that is stored in some
configuration file as: password 123456;  The prompting and all is fine,
however, how can I make it so that it doesn't echo any characters?
Also, how can I parse the config file to see if the inputted password is

the same as the one they typed in?
2.)  How can I generate 32bit random hex #'s?  Should I just create a
32bit random integer, and then do a printf "%lx", $random;?  Is there a
way to tell rand I want hex #'s?
These random numbers aren't being used for seeding of another random
function or password stuff, so using the simple rand function will
work.  No trickery needed here.
3.)  If I have a directory /usr/local/foo:bar/  How can I print the
contents of all files contained within that directory?  All files within

that directory will be simple ASCII text.
4.)  I have some entries in a configuration file that read something
like:
mapfoo foo foo2 bar;  where foo and bar should refer to a directory
/usr/local/foo:bar/  How can I extract the foo and bar, and then print
the contents of all files under /usr/local/foo:bar/
5:)  Lastly, how can I print the everyline in the configuration file
that starts with a 32bit integer?  So, if the config was like:
1234 foo foo2 bar;
5678 foo2 foo3 bar2;
hehe haha;
whatever fooboy;

it would print the 1234 and 5678 lines only.

6.)  Due to the fact that I don't know much about signal handling in
Perl, how can I block all ctrl characters (C, Z etc.) from killing the
script.  The only way I want the user to kill the process is by typing
exit.

Thanks,

Mitch



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

Date: Tue, 18 May 1999 03:37:46 GMT
From: tbsmith@deltacom.net
Subject: Re: Sorting my list...
Message-Id: <7hqnaa$h79$1@nnrp1.deja.com>

In article <7hpus0$og$1@nnrp1.deja.com>,
  me@alistair.com wrote:
> Sorry if this got posted twice...new at DejaNews too.
>
> I am trying to properly sort a list of browsers that have been to my
> site.  I am a newbie at this type of Perl function and I'm not sure
how
> to go about it.
>
> I have a list of about 100 browser visits that make up around 8-10
> different browsers.  I'd like to read that list and print the results
> sorted by number of times X browser hit the site.
>
> How would I go about doing this?  You can see the list at my website:
> http://www.alistair.com
>
> Any help would be appreciated.

Part of your list-

22:28:28 5/09/99|Mozilla/4.0 (compatible; MSIE 5.0; Windows 95)
22:33:00 5/09/99|Mozilla/4.5 [en]C-SYMPA (Win95; I)
22:42:34 5/09/99|209.53.12.155||Mozilla/4.5 [en]C-SYMPA (Win95; I)
22:46:27 5/09/99|Mozilla/4.5 [en]C-SYMPA (Win95; I)
22:46:39 5/09/99|Mozilla/4.0 (compatible; MSIE 5.0; Windows 95)
22:47:19 5/09/99|Mozilla/3.0 Gold (Win95; I)
22:49:29 5/09/99|Mozilla/4.0 (Windows 95;US) Opera 3.60 [en]
22:54:34 5/09/99|Lynx/2.8.1rel.1 libwww-FM/2.14FM
22:58:07 5/09/99|Mozilla/3.0 WebTV/2.2 (Compatible; MSIE 2.0)
23:07:55 5/09/99|Bobby 3.0
23:10:37 5/09/99|WebAgent (http://www.julianhaight.com/webagent.shtml)
23:32:26 5/09/99|Mozilla/4.0 (Windows 95;US) Opera 3.60 [en]
23:33:45 5/09/99|Mozilla/4.0 (Windows 95;US) Opera 3.60 [en]
23:33:50 5/09/99|Mozilla/4.0 (Windows 95;US) Opera 3.60 [en]
23:34:34 5/09/99|Mozilla/4.0 (Windows 95;US) Opera 3.60 [en]
23:34:36 5/09/99|Mozilla/4.0 (Windows 95;US) Opera 3.60 [en]
23:35:23 5/09/99|Mozilla/4.0 (Windows 95;US) Opera 3.60 [en]
23:36:17 5/09/99|Mozilla/4.0 (Windows 95;US) Opera 3.60 [en]

open I, "file_with_list" or die "bleh: $!\n";
@i = <I>;
close I;
for (@i) { chomp; s/.+\|//; $h{$_}++; }
print map {
    "$_ has been here $h{$_} time".
    ($h{$_} > 1 ? 's' : '') . ".\n"}
reverse sort {$h{$a} <=> $h{$b}} grep {$h{$_} =~ /./} keys %h;


>
> Alistair Calder
>
> --== Sent via Deja.com http://www.deja.com/ ==--
> ---Share what you know. Learn what you don't.---
>

--
----------------
Todd Smith -japh
ITC^DeltaCom
tbsmith@deltacom.net


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: 17 May 1999 20:37:36 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Sorting problem
Message-Id: <m1vhdrm4jj.fsf@halfdome.holdit.com>

>>>>> "Arjun" == Arjun Ray <aray@nmds.com> writes:

Arjun> Isn't it also (a philosphical?) part of the canonical form to eschew
Arjun> temporaries? So, would this kind of Transform Thing, then, qualify as
Arjun> an extension of the canonical form?

Arjun>     print
Arjun>     map  { '<tr><td>'
Arjun>          . join( '</td><td>', map { /^$/ and "-" or $_ } @$_ )
Arjun>          . "</td></tr>\n" }
Arjun>     sort { $b->[2] <=> $a->[2] }
Arjun>     grep { $_->[1] =~ m/$FORM{'TNSET'}/i }
Arjun>     map  { chop if /\n$/ ; [split /;/] }
Arjun>     (@techlines) ;

Arjun> (I know I've got something wrong somewhere, but this is fun!)

Naaah... I'd go with more of:

    print
      map "<tr>$_</tr>",
      map { join "", map { "<td>".(/^$/ ? "-" : $_)."</td>" } @$_ }
      sort { $b->[2] <=> $a->[2] }
      grep { $_->[1] =~ m/$FORM{'TNSET'}/i }
      map { chomp; [ split /;/ ] }
      @techlines;

But no, that's not the canonical Schwartzian Transform either, not
as coined by Mr. Christiansen.

print "Just another Perl 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, 18 May 1999 03:12:10 GMT
From: tbsmith@deltacom.net
Subject: Re: Using split with map, then join
Message-Id: <7hqlq9$g50$1@nnrp1.deja.com>

In article <7hq85h$78f$1@nnrp1.deja.com>,
  lou@visca.com wrote:
> I'm trying to use map to select certain fields from a bar-separated
flat
> file database and thus produce a smaller flat file database. After
> splitting, when I put the bars back in using join, I have to do a
rather
> clumsy little substitution. I would be grateful if someone could
suggest
> a better way. Here's a sample of the database:
>
> #1001|NRFB|820|Barbie in Mexico|NRFB|1|$250|A|02/19/99
> #1002|NRFB|785|Dreamboat|NRFB|1|$80|A|02/19/99
> #1004|NRFB|778|Ken in Mexico|NRFB|1|$175|A|02/19/99
>
> And here's the script:
>
> #!/usr/local/bin/perl
>
> use strict;
> use diagnostics;
>
> my $data = 'database3.txt';
>
> open DAT, $data or die $!;
> my @data = <DAT>;
> close DAT or die $!;
>
> my @newdata = map {(split /\|/)[0,3..6], "\n"} @data;
> my $new = join '|', @newdata;
> $new =~ s/\|\n\|?/\n/g;
> print $new;

looks fine to me, but if you wanted it all in one line, do this
(untested):

print join '|', grep /./s, map {(split /\|/)[0,3..6], "\n"} @data;

If that's not what you were talking about, ... uh ... sorry.

> ----------
> prints:
> #1001|Barbie in Mexico|NRFB|1|$250
> #1002|Dreamboat|NRFB|1|$80
> #1004|Ken in Mexico|NRFB|1|$175
>
> Thanks.
> Lou Hevly
> lou@visca.com
>
> --== Sent via Deja.com http://www.deja.com/ ==--
> ---Share what you know. Learn what you don't.---
>

--
----------------
Todd Smith -japh
ITC^DeltaCom
tbsmith@deltacom.net


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: 18 May 1999 01:58:10 GMT
From: lvirden@cas.org
Subject: Where to start [Was: Re: perldoc question
Message-Id: <7hqhfi$ca1$1@srv38s4u.cas.org>


According to  <tbsmith@deltacom.net>:
:My answer may be in the doc itself, but I wouldn't know where to start
:looking. I'm wondering what the number means in the parens after a named

Well, one place to check is here in comp.lang.perl.misc, where the FAQ
is posted at least once a month in individual articles covering each topic.
So either searching the subject lines, or Deja.com or one of the other
usenet archives would be a place to begin as well.

-- 
<URL: mailto:lvirden@cas.org> Quote: Saving the world before bedtime.
<*> O- <URL: http://www.purl.org/NET/lvirden/>
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.


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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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