[15716] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3129 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 23 00:05:52 2000

Date: Mon, 22 May 2000 21:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <959054710-v9-i3129@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 22 May 2000     Volume: 9 Number: 3129

Today's topics:
        Announce: kcdfind (ISO-title-aware CD cataloger) <kudla@ties.org>
    Re: Basic scripting question <uri@sysarch.com>
    Re: Building a hash array <lr@hpl.hp.com>
        Haiku <bmb@dataserv.libs.uga.edu>
    Re: Haiku <elaine@chaos.wustl.edu>
    Re: Help with emailing files <gasior@snet.net>
    Re: Help with emailing files <gasior@snet.net>
    Re: Help with emailing files <jeff@vpservices.com>
        Including variables defined outside the script <isd@mail.as.uaf.edu>
        join " ", do {$x++}, do {$x++}, do {$x++}; <Tbone@pimpdaddy.com>
        Just Beggining Perl Question <jkipp5@home.com>
    Re: Just Beggining Perl Question <zigouras@mail.med.upenn.edu>
    Re: Modules - Newbie question <jeff@vpservices.com>
        Newbie: How to completely uninstall perl (W32) <tjones@sebringring.com>
    Re: Perl problems under Solaris <elaine@chaos.wustl.edu>
    Re: regexes *sigh* damn I hate these things <nospam@devnull.com>
    Re: regexes *sigh* damn I hate these things <nospam@devnull.com>
    Re: regexes *sigh* damn I hate these things <Tbone@pimpdaddy.com>
    Re: SDBM_File - %HASH not returning all records ? <bwalton@rochester.rr.com>
    Re: sorting a list of mixed numbers and text as in perl <nospam@devnull.com>
    Re: sorting a list of mixed numbers and text as in perl <nospam@devnull.com>
    Re: sorting a list of mixed numbers and text as in perl <nospam@devnull.com>
        splitting lines of DOS file in UNIX <jdhunter@nitace.bsd.uchicago.edu>
    Re: Tanspose rows to columns <xah@xahlee.org>
    Re: Tanspose rows to columns <uri@sysarch.com>
    Re: Tanspose rows to columns (Andrew Johnson)
    Re: Tanspose rows to columns <elaine@chaos.wustl.edu>
        Testing the getstore function in the LWP::Simple module (Sordid One)
    Re: the use of $_ (Philip 'Yes, that's my address' Newton)
        Trying to include variables <isd@mail.as.uaf.edu>
    Re: Trying to include variables <jhiller@online-testing.net>
    Re: updated : Re: regexes *sigh* damn I hate these thin <nospam@devnull.com>
    Re: updated : Re: regexes *sigh* damn I hate these thin <nospam@devnull.com>
    Re: updated : Re: regexes *sigh* damn I hate these thin <nospam@devnull.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 22 May 2000 23:42:34 -0400
From: Rob <kudla@ties.org>
Subject: Announce: kcdfind (ISO-title-aware CD cataloger)
Message-Id: <2fspOVYrJ7ppGnh3SlgLJushfuno@4ax.com>

cdfind 0.10 is a command-line CD cataloging system which uses the
ISO9660 CD title as a disc identifier, eliminating a lot of
typing.  You can scan discs, search them, or generate a summary.
cdfind uses CSV files to store its data, which makes it slow, but
this way you don't have to install a database server just to
catalog your CD's.

kcdfind 0.10 is the PerlQt graphical interface to cdfind.  It
displays results in a table which you can sort by any column.
Downloads and screenshot at:

http://www.kudla.org/raindog/perl

Both are GPL'ed and both require the CD::Info Perl module (among
other things) available from the same page.

Rob

kudla@ties.org - http://kudla.org/raindog


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

Date: Tue, 23 May 2000 02:51:29 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Basic scripting question
Message-Id: <x77lcmdln3.fsf@home.sysarch.com>

>>>>> "G" == Godzilla!  <godzilla@stomp.stomp.tokyo> writes:

  G> $line_counter = 1;

  G> open (NEW, ">test.txt");

  G> foreach $new_line (@Test)
  G>  {
  G>   if ($line_counter < 3)
  G>    { 
  G>     print NEW $new_line; 
  G>     $line_counter++;
  G>    }
  G>   elsif ($line_counter = 3)
  G>    { 
  G>     $line_counter = 1;
  G>     next; 
  G>    }
  G>  }

  G> As you can see, every third line is
  G> skipped over by "next;" in printing
  G> your new file, only those you want
  G> are printed.

the next in there is redundant and useless. you would fall out of the
else clause and do the next loop anyway. so why is there no next after
the print clause?

and why the elsif? if $line_counter is not < 3, and you reset it to 1,
it must == 3 there. typical of your logic, you don't even know how to do
basic counting.

and what a shitload of code to do this:

	perl -ne 'print unless $. % 3' input_file > output_file

but you, of course, never want perl to do any work for you. and since
you only post web based code, useful stuff like one liners are out of
your domain.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Mon, 22 May 2000 18:21:16 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Building a hash array
Message-Id: <MPG.13937ce9e7e25de398aab5@nntp.hpl.hp.com>

In article <Pine.GSO.4.10.10005221634340.23375-
100000@user2.teleport.com> on Mon, 22 May 2000 16:36:46 -0700, Tom 
Phoenix <rootbeer@redcat.com> says...
> On Mon, 22 May 2000, Larry Rosler wrote:
> 
> > > > $ARGV[5] will be of the form jim~jack~jill. 
> 
> > >     $AccountAliasList = [ split /j*/, $ARGV[5] ];
> 
> > I think that when you wrote the regex for that split your mind was 
> > elsewhere.
> 
> No, I was splitting it into empty string, im~, ack~, and ill. 

Oh, were you now?  But /j*/ produces the same split as //, doesn't it?

perl -le "print join '|' => split /j*/ => 'jim~jack~jill'"

|i|m|~|a|c|k|~|i|l|l

> >     ... split /~/, ...
> 
> Okay, that's another way to split the string. The OP had talked about
> getting "lines" from the split, so I don't see why your way is any better
> than mine. :-)

This is what I find in the OP:

> > Where the elements of the hash array would comprise of jim, jack and
> > jill

We all have bad days, I guess.  :-)

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


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

Date: Mon, 22 May 2000 22:56:28 -0400
From: Brad Baxter <bmb@dataserv.libs.uga.edu>
Subject: Haiku
Message-Id: <Pine.GSO.4.21.0005222251010.6089-100000@dataserv.libs.uga.edu>

Okay, here's my haiku entry.  (I forget the rules.)

 1  #!/usr/local/bin/perl -w
 2  use strict;
 3
 4  sub AUTOLOAD{
 5  print+($_=((split/::/,$main::AUTOLOAD)[1]))eq'_'?"\n":"$_ "}
 6  use subs qw(
 7
 8      dragons hide in words _
 9      quiet faithful lovers please _
10      tender caresses _
11
12  );_
13
14  hide dragons in words _
15  lovers faithful quiet please _
16  caresses tender _

It probably doesn't qualify as Perl poetry.

Sosumi :-)

-- 
Brad



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

Date: Tue, 23 May 2000 03:34:28 GMT
From: Elaine Ashton <elaine@chaos.wustl.edu>
Subject: Re: Haiku
Message-Id: <B54F7482.489D%elaine@chaos.wustl.edu>

in article Pine.GSO.4.21.0005222251010.6089-100000@dataserv.libs.uga.edu,
Brad Baxter at bmb@dataserv.libs.uga.edu quoth:

> Okay, here's my haiku entry.  (I forget the rules.)

http://history.perl.org/CHI/ :)

e. 




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

Date: Tue, 23 May 2000 01:31:27 GMT
From: Robert Gasiorowski <gasior@snet.net>
Subject: Re: Help with emailing files
Message-Id: <3929EDEA.FDDDB746@snet.net>

Thanks,
I tried to type uuencode and I got message: command not found
Then I replaced the line as you suggested and email was sent with no
error
and still without attached file.



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

Date: Tue, 23 May 2000 01:32:38 GMT
From: Robert Gasiorowski <gasior@snet.net>
Subject: Re: Help with emailing files
Message-Id: <3929EE31.D71B2D0B@snet.net>

Where can I find info about CPAN?



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

Date: Mon, 22 May 2000 18:43:02 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Help with emailing files
Message-Id: <3929E226.7D366DC7@vpservices.com>



Robert Gasiorowski wrote:
> 
> Where can I find info about CPAN?

www.cpan.org

!

-- 
Jeff


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

Date: Mon, 22 May 2000 16:56:35 -0900
From: "Joshua J. Kugler" <isd@mail.as.uaf.edu>
Subject: Including variables defined outside the script
Message-Id: <8gcl1l$tu8$1@news.alaska.edu>

[Sorry if this is a repost, but my news software, or server is being tweaky.

In in the file MyModule.pm, there are a few lines like this:

my $var="data';
my $var2="moredata";

In my script, I have these lines:

use lib "path/to/my/modules/dir";
use strict;
use MyModule;

It finds MyModule (no errors reported), but when I try to use those variables, it says
they must have explicit package names.  I know this means the variables aren't getting
defined, but why?  The module does not have any "package" statements in it.  Why aren't
the variables being defined in $main:: ?

I read the pertinant parts  in the Camel book, and searched deja, but it hasn't clicked in my
head. Any hints?

I'm not to sure about my news server, so please e-mail the reply too.

Thanks, 

j----- k-----


-- 
Joshua Kugler
ASUAF Information Services Director
isd@as.uaf.edu



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

Date: 23 May 2000 03:11:58 GMT
From: Intergalactic Denizen of Mystery <Tbone@pimpdaddy.com>
Subject: join " ", do {$x++}, do {$x++}, do {$x++};
Message-Id: <8gcstu$2hiq$1@news.enteract.com>

I seem to have lost the ability to RTFM... could someone point me
to where it says that the above (see subject line) will guarantedly
produce "1 2 3"?



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

Date: Tue, 23 May 2000 03:12:39 GMT
From: Jim Kipp <jkipp5@home.com>
Subject: Just Beggining Perl Question
Message-Id: <3929F774.D3A6A39F@home.com>

Hello
Very new to perl and programming. I am trying to complete an
exercize in a book.
I wan to open a file, read into an array, then print 5 lines
at a time. The user would press enter to see the next five
lines. I have been trying to figure out the 5 lines at a
time part, but can't.

open(FILE, ">test.txt");
@array = <FILE>;
 ....

thanks
Jim


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

Date: Mon, 22 May 2000 23:37:09 -0400
From: Nico Zigouras <zigouras@mail.med.upenn.edu>
To: Jim Kipp <jkipp5@home.com>
Subject: Re: Just Beggining Perl Question
Message-Id: <Pine.OSF.4.21.0005222336100.2943-100000@mail.med.upenn.edu>

take out the '>' in the file name:

 open(FILE, "test.txt");
 @array = <FILE>;

and get in the habit of closing file handles.

  close( FILE );

On Tue, 23 May 2000, Jim Kipp wrote:

> Date: Tue, 23 May 2000 03:12:39 GMT
> From: Jim Kipp <jkipp5@home.com>
> Newsgroups: comp.lang.perl.misc
> Subject: Just Beggining Perl Question
> 
> Hello
> Very new to perl and programming. I am trying to complete an
> exercize in a book.
> I wan to open a file, read into an array, then print 5 lines
> at a time. The user would press enter to see the next five
> lines. I have been trying to figure out the 5 lines at a
> time part, but can't.
> 
> open(FILE, ">test.txt");
> @array = <FILE>;
> ....
> 
> thanks
> Jim
> 



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

Date: Mon, 22 May 2000 18:05:15 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Modules - Newbie question
Message-Id: <3929D94B.66FF6513@vpservices.com>

Simon McGregor wrote:
> 
> What happens when you install a Perl module?

The earth moves, the clouds rumble, and lightning bolts fly through the
air.  YMMV.

> And can someone explain to me in plain language what the difference between
> "use" and "require" is? I can't quite seem to see what "use" is doing (and
> in general I haven't got my head around the way Perl does object
> orientation).

If the module has functions which are exported, then "use" imports them
but "require" does not.  That is to say if a module foo defines a
function bar() and exports that function,  this would work:

  use foo;
  &bar();

and this would not:

  require "foo.pm";
  &bar();

But neither of those has anything to do with object orientation.  Only
some modules use object orientation, others do not.

> I'm asking partly because I want to know if it's possible to use the
> functionality of a Perl module in a script without having the necessary
> permissions to actually install the module.

That doesn't have anything to do with whether you use "use" or
"require".  The module would need to be installed for both.  And when
you say you do not have permission to install modules, do you mean that
you do not have permission to install modules as root in the standard
Perl library (which is true for many people who never-the-less install
many modules), or do you mean you do not have permission to install
modules even in your own directories?  If the former, just read the FAQ
on maintaining your own library of modules.  If the latter, then you may
be SOL as far as modules go.

>  We develop a lot of scripts
> which end up on sites we don't host, so installing a module is sometimes out
> of the question.

Again, bazically, not having root priveledges is not a bar to fooling
around with modules.  If you can install scripts on those sites, there
is probably no reason you can't also install modules there as well.

-- 
Jeff


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

Date: Mon, 22 May 2000 18:56:54 -0700
From: "Thomas C. Jones" <tjones@sebringring.com>
Subject: Newbie: How to completely uninstall perl (W32)
Message-Id: <3929E566.C5ADC682@sebringring.com>

Hello,

Pardon the newbie question.

In my abortive attempt to install ActiveState's latest Perl onto Win32 I
seemed to have foobar'd something and now some scripts fail with cryptic
messages.  I think it may have something to do with the back-slash
forward-slash dichotomy of Win32.

In any case, I'd like to get back, back to where I once belonged.  I
would like to remove all traces of this god-foresaken version of Perl
and all previous versions for that matter and start from scratch.

Does anyone have any suggestions on how to completely remove Perl?

Thanks, Tom



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

Date: Tue, 23 May 2000 03:52:03 GMT
From: Elaine Ashton <elaine@chaos.wustl.edu>
Subject: Re: Perl problems under Solaris
Message-Id: <B54F78A1.489E%elaine@chaos.wustl.edu>

in article 392957bc.778179002@news.supernews.com, Mark McWiggins at
mark@IcanFixYourEmail.com quoth:

> II've had minor problems with Perl under Solaris since about version
> 5.004 ... Most annoying problem is that it dumps core in
> 
> __do_global_dtors_aux()

Woof. That isn't a Perl problem, that's a system lib barf. Is this a
threaded form of Perl?
  
> This is on a Solaris 2.7 Sparc 5 (not Ultrasparc, just regular old
> 1994 Sparc), compiled with gcc 2.95.1.

Hmmm...what patchlevel and do you have SparcWorks cc on the box? Also, a
1994 sparc would be either a 4m or a 4c depending on the box. And it's
really Solaris 7 or 5.7 but 2.7 is ok too :)

> Anybody having a better experience with this?

Sparc Solaris is one of the easiest platforms to get a good build of Perl.
I'm suspicious that you either have a really hosed box or you are mixing and
matching your modules between cc and gcc or are having a rough time with
threaded Perl.

e. 




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

Date: 23 May 2000 01:49:48 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: regexes *sigh* damn I hate these things
Message-Id: <8gco3s$950$1@216.155.33.26>

In article <8gca7q$1t42$1@news.enteract.com>, Tbone@pimpdaddy.com wrote:

 | This bonding is bringing tears to my eyes

Yeah yeah yeah, what, you never saw a polite discussion around here before?

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: 23 May 2000 01:50:21 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: regexes *sigh* damn I hate these things
Message-Id: <8gco4t$950$2@216.155.33.26>

In article <MPG.13932e61efc4c80498aaaf@nntp.hpl.hp.com>, Larry Rosler 
<lr@hpl.hp.com> wrote:

 | > dunno about 'so long' as 80 cols is fairly standard, no? 
 | 
 | No.  It is better to use 72 columns, so quoting -- even twice -- doesn't 
 | cause ugly unintended rewrappings.

so noted, and changed.

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: 23 May 2000 03:09:29 GMT
From: Intergalactic Denizen of Mystery <Tbone@pimpdaddy.com>
Subject: Re: regexes *sigh* damn I hate these things
Message-Id: <8gcsp9$2h5v$1@news.enteract.com>

nospam@devnull.com writes:
>In article <8gca7q$1t42$1@news.enteract.com>, Tbone@pimpdaddy.com wrote:
>
> | This bonding is bringing tears to my eyes
>
>Yeah yeah yeah, what, you never saw a polite discussion around here before?

You are still reading my posts? That's very irresponsible of you!
I spoke in confidence that the *plonk* was for real.

Well, if you are serious, let me quickly make it known that "Godzilla"
is a repressed little weenie with no particular talent except the
relentlessness that goes with stupidity. The code in those posts is
not worth analyzing or discussing, so take it as official that you
have wasted a huge amount of your time with your "polite discussion".

I luckily don't care much about how you feel--still, understand that
I am not saying the above in order to make you feel stupid. I'd rather
you did not waste your time with moronic exchanges about useless code.



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

Date: Tue, 23 May 2000 02:46:45 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: SDBM_File - %HASH not returning all records ?
Message-Id: <3929EFF0.F4FF367F@rochester.rr.com>

Miggy wrote:
> 
> I'm working with ActivePerl 613 on a Windows 98 SE box through
> MS-DOS prompt.
 ...
SDBM doesn't work on FAT file systems  (
http://www.gorski.net/scripts/lists/www-scripts/1997/04/msg00199.html
for example).  The symptoms are that it only returns a fraction (like
maybe 2/3) of the records that were written.  I don't know if it works
on FAT32 or not, which is probably what you are using (I would guess it
doesn't work, given the symptoms you describe). SDBM does work 100% on
NTFS.

If you want to try DB_File, it comes with Perl and works.  You should be
able to use it without modification of your program just by adding a use
DB_File; and changing your tie statement.
-- 
Bob Walton


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

Date: 23 May 2000 01:12:16 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: sorting a list of mixed numbers and text as in perldoc
Message-Id: <8gcltg$4mr$0@216.155.33.26>

In article <MPG.139311bb8e56dbbd98aaac@nntp.hpl.hp.com>, Larry Rosler 
<lr@hpl.hp.com> wrote:

 | #!/usr/local/bin/perl -w
 | use strict;
 | 
 | my @unsorted = qw[hi low 1 2 3 yo what's up dawg?];
 | 
 | my @sorted = map substr($_, 1 + rindex $_, "\0") => sort
 |     map { (/(\d+)/ ? 0 . pack N => $1 : 1 . uc) . "\0$_" } @unsorted;
 | 
 | print "@unsorted\n@sorted\n";
 | 

Larry, this still results in 
====
hi low 1 2 3 yo what's up dawg?
1 2 3 dawg? hi low up what's yo
====

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: 23 May 2000 01:17:00 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: sorting a list of mixed numbers and text as in perldoc
Message-Id: <8gcm6c$4mr$1@216.155.33.26>

In article <slrn8il7nt.5tv.tjla@thislove.dyndns.org>, tjla@guvfybir.qlaqaf.bet 
(Gwyn Judd) wrote:

 | #!/usr/bin/perl -w
 | 
 | use POSIX qw(INT_MAX);
 | 
 | @old = qw(hi low 1 2 3 yo what's up dawg?);
 | 
 | $numbers_ascending = 1;
 | $text_ascending = 1;
 | 
 | $text_first = 1;
 | 
 | $text_val = [[-1,1],[1,-1]]->[$numbers_ascending][$text_first] *
 | INT_MAX;
 | 
 | @new = map { $_->[0] }
 |   sort { ($a->[1] <=> $b->[1]) * ($numbers_ascending ? 1 : -1)
 |                  ||
 |          ($a->[2] cmp $b->[2]) * ($text_ascending ? 1 : -1)
 |   } map { [$_, m/(\d+)/ ? $1 : $text_val, uc($_)] } @old;
 | 
 | print join " ", @old;
 | print "\n";
 | print join " ", @new;

pshew.. 

THIS one gives the correct output here too.

====
hi low 1 2 3 yo what's up dawg?
dawg? hi low up what's yo 1 2 3
====

that's a heck of an explanation, and seems like quite a complex way of doing 
this. It seems kind of odd to have to go through such contortions to get this to 
sort this way. 

I wonder how this will handle characters that are non- \w ? 

gonna play with this a bit.. I might be able to use this if this particular 
version does what I need it to, albiet in a convoluted way that I can only 
barely follow. :)

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: 23 May 2000 01:43:21 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: sorting a list of mixed numbers and text as in perldoc
Message-Id: <8gcnnp$950$0@216.155.33.26>

In article <slrn8il7nt.5tv.tjla@thislove.dyndns.org>, tjla@guvfybir.qlaqaf.bet 
(Gwyn Judd) wrote:

 | ewww you found a bug :). looks like the "text_first" thingy only works
 | correctly when we try to sort the numbers in reverse order, otherwise we
 | have to reverse the sense of it. It's not a very well named variable
 | either. oh well I am only an egg.

'only an egg' LOL :D good book. 

well, try THIS puppy on for size. I would like to come up with a way to sort a 
list of the map-names for Unreal Tournament that get submitted to the site I do 
reviews for.. and there are some who put numbers or [] type characters in the 
filenames to make it sort higher (a big no-no). 

The main admin of the site has to manually do his listing of these to force them 
to the bottom of the list instead (evil grin), but since I patched together a 
little cgi/perl script to work with this listing more flexibly, the sorting 
breaks and I have to let 'scum' rise to the top. 

I tried some of the map names in this script instead of the simple words that 
were listed here, and got some _really_ weird results

#!/usr/bin/perl -w

use POSIX qw(INT_MAX);

@old = qw(DM-007Archives DM-007Stack DM-1 DM-88][ DM-Abandoned DM-LongestYard][ 
DM-Concussion DM-Psykosis][ DM-Way2to4 DM-Zyklotron DM-[tech]labyrinth 
DM-ForwardThrust DM-Gemetzel DM-[tech]labyrinth2);

$numbers_ascending = 1;
$text_ascending = 1;

$text_first = 1;

$text_val = [[-1,1],[1,-1]]->[$numbers_ascending][$text_first] * INT_MAX;

@new = map { $_->[0] }
  sort { ($a->[1] <=> $b->[1]) * ($numbers_ascending ? 1 : -1)
                 ||
         ($a->[2] cmp $b->[2]) * ($text_ascending ? 1 : -1)
  } map { [$_, m/(\d+)/ ? $1 : $text_val, uc($_)] } @old;

$count = scalar(@old);

for ($i=0; $i < $count; $i++) {
print "old = $old[$i]\n", '.' x 50, "new = $new[$i]\n";
}

exit;

this results in the VERY oddly-sorted:

====
old = DM-007Archives
 ..................................................new = DM-Abandoned
old = DM-007Stack
 ..................................................new = DM-Concussion
old = DM-1
 ..................................................new = DM-ForwardThrust
old = DM-88][
 ..................................................new = DM-Gemetzel
old = DM-Abandoned
 ..................................................new = DM-LongestYard][
old = DM-LongestYard][
 ..................................................new = DM-Psykosis][
old = DM-Concussion
 ..................................................new = DM-Zyklotron
old = DM-Psykosis][
 ..................................................new = DM-[tech]labyrinth
old = DM-Way2to4
 ..................................................new = DM-1
old = DM-Zyklotron
 ..................................................new = DM-Way2to4
old = DM-[tech]labyrinth
 ..................................................new = DM-[tech]labyrinth2
old = DM-ForwardThrust
 ..................................................new = DM-007Archives
old = DM-Gemetzel
 ..................................................new = DM-007Stack
old = DM-[tech]labyrinth2
 ..................................................new = DM-88][
====

any clues? 

DM-Way2to4 should sort above Zyklotron, technically, and DM-[tech]labyrinth 
should sort below DM-88][

(they use the ][ construct like a roman numeral II.. it gets worse when they put 
a damn pipe symbol in there to make a III like CTF-Face]|[ *sigh*)

Obviously this method of sorting isn't exactly a universal solution yet.. needs 
a little more seasoning. ;)

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: 22 May 2000 21:50:18 -0500
From: John Hunter <jdhunter@nitace.bsd.uchicago.edu>
Subject: splitting lines of DOS file in UNIX
Message-Id: <1raehi6kut.fsf@video.bsd.uchicago.edu>

I have a tar file of MSDOS ascii files that I need to work with (on a
UNIX/Linux platform).  I am using Archive-Tar to read in an entire
file as a string from the tar file and then want to do pattern
matching on the individual lines.


Entries in the file look like (ignore leading spaces):
  200,"Record time before and after Stimulus onset (s)"
  8000,"Total stimulus time (s)"
  0,"Time to begin spike frequency averaging (s)"

and I want to populate a hash with the stuff in the double quotes as a
key for the integer values to the left of the comma.  Here is a code
snippet:

my $content = $tar->get_content("params/params.par");
  my $line;
  foreach $line ( split("[\n\r]+", $content) ) {
    if (m/(\d+),"(.*)"/) {
      $params{$2} = $1 ;
    }
    else {
      print "no match on: $line.\n";
    }
  }

The output of this code is a bunch of 'no match' lines as in:
  no match on: 200,"Record time before and after Stimulus onset (s)".
  no match on: 8000,"Total stimulus time (s)".
  no match on: 0,"Time to begin spike frequency averaging (s)".

I have tried variations of the regexp to no avail.  I know that the
ascii chars 10 and 13 are lurking here, but my attempts at matching
them using the equivalent octal codes (\012 and \015 right?) did not
work either.  

Suggestions will be appreciated,
John Hunter


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

Date: Mon, 22 May 2000 19:19:54 -0700
From: Xah <xah@xahlee.org>
Subject: Re: Tanspose rows to columns
Message-Id: <B54F38DA.A2B0%xah@xahlee.org>

I wrote:
>> Yes, and if you could show me it without eval i would sprawl and bark like a
>> dog for your entertainment. I'll show that, how one of us, is utterly
>> willing but not able. Honest. I'll give you Perl folks 1 week.

Ilmari Karonen <iltzu@sci.invalid> wrote:
> The whole module, or just the transpose part?

Just the Transpose function.

> # warning: untested code
>...

Do not equivocate. I'm not impressed by half-assed showoffs nor asked for
ideas of alternative approaches at this moment.

What i asked is simple: write the _stand along_ Transpose function as i have
spec'ed it out in my earlier message. (or on my website
http://xahlee.org/PerlMathematica_dir/perlMathematica.html
)

You may filch my algorithm/methodology, but not copy/rely from my
subroutines. If anyone can do it without using 'eval', then i'd be
_extremely_ impressed.

Unix weenies say: "where is the code?"

Here's a chance for you perlers of beady eyes, to put words where your mouth
is. You have 1 lush week to show off. Of course, if this challenging
challenge degenerates into a chat on possibilities or other inanities, you
show the world how beady Perler's eyes are. Braggarts & mongers come
forward. This is the time to defend your perl-perl-land!

 Xah
 xah@xahlee.org
 http://xahlee.org/PageTwo_dir/more.html





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

Date: Tue, 23 May 2000 02:57:14 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Tanspose rows to columns
Message-Id: <x74s7qdldj.fsf@home.sysarch.com>

>>>>> "X" == Xah  <xah@xahlee.org> writes:

  X> is. You have 1 lush week to show off. Of course, if this
  X> challenging challenge degenerates into a chat on possibilities or
  X> other inanities, you show the world how beady Perler's eyes
  X> are. Braggarts & mongers come forward. This is the time to defend
  X> your perl-perl-land!

how about, i don't give a shit about your transpose. it is a purely
algorithmic problem solved in many languages. use apl already and go
away. if you hate perl so much, why bother posting here? i don't go
flaming in python?

now shoo!!

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Tue, 23 May 2000 03:30:52 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Tanspose rows to columns
Message-Id: <MXmW4.15510$95.219861@news1.rdc1.mb.home.com>

In article <B54F38DA.A2B0%xah@xahlee.org>,
 Xah <xah@xahlee.org> wrote:
[snip]
> 
> Here's a chance for you perlers of beady eyes, to put words where your mouth
> is. You have 1 lush week to show off. Of course, if this challenging
> challenge degenerates into a chat on possibilities or other inanities, you
> show the world how beady Perler's eyes are. Braggarts & mongers come
> forward. This is the time to defend your perl-perl-land!

Your challenge is a chimera. What kind of challenge is this? One
person asked if you must eval() to do your transpose() function, and
now suddenly your challenge to Perl community is that we must arrive
at an equivelant to your code without using eval()? And if no one
does then what -- this is somehow a shot against the Perl language?
or the Perl community? (or just those of us who might have beady
eyes?). I submit that you have already solved your problem using Perl
(however sucky you feel the language is) -- your attempt to get
others to improve your Perl algorithm under the guise of a challenge
against Perl or the Perl community is, in a word, pathetic.

andrew

-- 
Andrew L. Johnson   http://members.home.net/andrew-johnson/epwp.html
      It may be that your sole purpose in life is simply to 
      serve as a warning to others.


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

Date: Tue, 23 May 2000 04:01:36 GMT
From: Elaine Ashton <elaine@chaos.wustl.edu>
Subject: Re: Tanspose rows to columns
Message-Id: <B54F7ADE.48A4%elaine@chaos.wustl.edu>

in article x74s7qdldj.fsf@home.sysarch.com, Uri Guttman at uri@sysarch.com
quoth:

> now shoo!!

/me starts tapping her watch and whistling 'anchors aweigh'....now I just
have to find that submarine captain.

:)

e.



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

Date: Tue, 23 May 2000 04:01:13 GMT
From: sordid@hotmail.com (Sordid One)
Subject: Testing the getstore function in the LWP::Simple module
Message-Id: <392a00cd.17438691@news.wolf>

Hey all! I'm having trouble testing the getstore function in the
Simple module. I've got a text file full of links, and once it gets to
a certain one (the link is for a really slow server) the program dies
because it cannot test the URL. So, what I'd like to do is somehow
test this line of code, and not by killing the program if it fails : 

$code = getstore($link, $file);

I could simply delete the link, but I'm sure more slow sites will show
up in my link list someday and I want to be prepared for them as well.
I'm stumped! I've tried the testing for definition, the eval
function...and nothing has yeilded even a clue!

Any suggestions would be greatly appreciated!!

Scott


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

Date: Tue, 23 May 2000 03:48:33 GMT
From: nospam.newton@gmx.li (Philip 'Yes, that's my address' Newton)
Subject: Re: the use of $_
Message-Id: <3929ff3a.554608000@news.nikoma.de>

On Mon, 22 May 2000 00:07:46 GMT, Elaine Ashton <elaine@chaos.wustl.edu>
wrote:

>in article 958938961.716827@shelley.paradise.net.nz, Tintin at
>you.will.always.find.him.in.the.kitchen@parties quoth:
> 
>> Please name me just one current Operating System that comes with Perl 4.
>
>HP-UX though it isn't installed with the OS by default.

And AFAIK it's only supported in the context of q4 (was that its name?),
the kernel debugger.

Just like the only reason they ship a (K&R) C compiler with the OS is to
recompile the kernel -- if you want to do serious C compiling, you're
supposed to buy their for-cost compiler (which does do ANSI).

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
If you're not part of the solution, you're part of the precipitate.


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

Date: Mon, 22 May 2000 10:53:12 -0900
From: "Joshua J. Kugler" <isd@mail.as.uaf.edu>
Subject: Trying to include variables
Message-Id: <8gbvo9$j41$1@news.alaska.edu>

I've read the camel book, and searched deja, but haven't come up with an answer.

I'm trying to "include" a file that defines some variables, but they aren't being defined
correctly.

DBInfo.pm contains:

#information about database stuff

my $asuaf_database = "asuaf";
my $mysql_hostname = "";
my $asuaf_database_user = "username";
my $asuaf_database_password = "*****";
my $user_table = "users";

1;

My script contains (showing pertinant parts):

use DBInfo;
use strict;
my $dbh; 

#create a new mysql object and connect to the server
$dbh = DBI->connect("DBI:mysql:$asuaf_database:$mysql_host::", $asuaf_database_user, $asuaf_database_password);

When I try to run it, for each of the variables defined in DBInfo.pm, it gives me

Global symbol '$variable_name' requires explicit package name at file.cgi at line ##.

I know I'm missing something, but what?  I know use includes files at compile time, but why
aren't the variable definitions taking effect?

Thanks!

j----- k-----

-- 
Joshua Kugler
ASUAF Information Services Director
isd@as.uaf.edu



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

Date: Tue, 23 May 2000 03:19:04 GMT
From: Jordan Hiller <jhiller@online-testing.net>
Subject: Re: Trying to include variables
Message-Id: <3929F8D5.18B8EA66@online-testing.net>

"Joshua J. Kugler" wrote:
> 
> DBInfo.pm contains:
> 
> #information about database stuff
> 
> my $asuaf_database = "asuaf";
> my $mysql_hostname = "";
> my $asuaf_database_user = "username";
> my $asuaf_database_password = "*****";
> my $user_table = "users";

Perhaps I'm going insane, but don't these "my"s make the variables local
to your included file?
 
Jordan Hiller
Online Quiz and Testing Solutions
http://www.online-testing.net/


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

Date: 23 May 2000 01:56:52 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: updated : Re: regexes *sigh* damn I hate these things
Message-Id: <8gcoh4$950$3@216.155.33.26>

In article <slrn8ij4q9.1bm.abigail@ucan.foad.org>, abigail@arena-i.com 
wrote:

 | Perhaps it's a good idea to actually write down a specification 
 | instead of using 
 | trial-and-error-and-start-over-again-on-each-next-example.

*sigh* tell me about it.. I no sooner solve one issue when he comes up 
with another one.. "oh, can you make it do THIS too?" *growl* 

:) still, I'm learning, and that's a good thing. If this were paying 
work, you can be assured that everything would be spec'd out in advance.

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: 23 May 2000 02:01:35 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: updated : Re: regexes *sigh* damn I hate these things
Message-Id: <8gcopv$950$4@216.155.33.26>

In article <39295071.83798E10@stomp.stomp.tokyo>, "Godzilla!" 
<godzilla@stomp.stomp.tokyo> wrote:

 | Your solution is still very simple.

well, it's close but no cigar yet.. what I need to do is to extract the 
*gametype* not the *map-name*.. 

since these are 'freshly uploaded reviews', it's easy enough to slurp 
the mapname from the filename of the review and chop off the .html (for 
the purpose of this script) 

basically the reason I need the gametype is so that I can break on 
sections

utassault
AS-FirePit (5), AS-Asthenosphere (8.5)

utdm
DM-AutoPlayArena (4.5), DM-Rag'na][ (8), DM-Whatever (2)

etc etc etc

this will also in a sneaky way allow me to insert a .jpg graphic icon 
for each section... utassault.jpg, utother.jpg, utdm.jpg, etc

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: 23 May 2000 02:08:05 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: updated : Re: regexes *sigh* damn I hate these things
Message-Id: <8gcp65$950$5@216.155.33.26>

In article <3928fc88.4177870@news.skynet.be>, bart.lateur@skynet.be 
(Bart Lateur) wrote:

 | >I need to ALSO extract the 'utdm' portion of the source file from the 
 | >lines like 
 | >"utdm/dm-cyberwar.zip" and "utdm/dm-nitro.zip"
 | >
 | >there MAY or may not be a / or a \n before the 'word' containing the 
 | >gametype. 
 | >(which may be anything from unrealdm, utdm, utctf, utassault, utother, 
 | >or 
 | >utdomination)
 | 
 | Tricky. Now we have a possible multiline match. I would think this may
 | need something like a state machine, which keeps track of where in the
 | current record we currently are.
 | 
 | >I don't quite understand how to tell the regex that - is a valid 'word' 
 | >character, so that it will find the utother/fire-logo-map.zip as well 
 | >as 
 | >utdm/DM-Halls_of_redemption.zip
 | 
 | You can't, AFAIK. It's a pity. "locale" seems to be doing it, but you
 | can't do it as a common user. Currently the best solution (5.6 may
 | provide features, but I consider it not Ready For The World just yet) is
 | to use a character class; possibly, for readability, you can put it in a
 | variable and use that variable in the regex -- don't forget the //o
 | switch.
 | 
 | 	$w = "[a-zA-Z0-9_\\-\\.]";
 | 	$_ = 'utdm/DM-Halls_of_redemption.zip etc. etc.';
 | 	print m!/($w+)!o;
 | 
 | 
 | Anyway, here's what I came up with (quickly thrown together, but it
 | seems to work on the example data):
 | 
 |  while(<DATA>) {
 |     if(/Name: +<a +href="http:[^"]+\?nalicity\//gi .. /\G([^"]+)"/g) {
 |         $name = $1 if defined $1;
 |     } elsif(/Rating: +\(1-10\) +([\d\.]+)/) {
 |         $rating = $1;
 |         print "Name = $name, rating = $rating\n";
 |     }
 |  }
 | __DATA__
 | (your example data here)
 | 
 | This gives:
 | 
 | 	Name = utdm/dm-cyberwar.zip, rating = 7.5
 | 	Name = utdm/dm-nitro.zip, rating = 9
 
well, this is close.. but you missed the part above where I mentioned 
that I needed to *extract* the gametype from the name. 

Ultimately I'll have as output.. 

Gametype = utdm, filename = dm-cyberwar(*1), rating = 7.5
Gametype = utdm, filename = dm-nitro, rating = 9

(*1 lopping off the .html from the filenae is quickest here since these 
are the files I'm scanning, so there's no need to try and extract 
$mapname from the html)

and pushing these results into a hash for sorting and output later.. as 
this way I can group reviews by gametype, and separate them with 
newlines (by slipping in a </p><p> pair in between sections) :)

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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

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

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


------------------------------
End of Perl-Users Digest V9 Issue 3129
**************************************


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