Script within a script

2004-01-14 Thread Kenneth W. Craft MCP
Is it possible to execute a perl script within another perl script?

I have advertisements on many of my pages of my site that are randomly
picked using a random ad script. I am creating some pages that are
dynamically being created, and I can't use ssi to pull the ads into the
page (right now on my main page I use !--#exec cgi -- to call the ad
scripts.

Thanks


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.558 / Virus Database: 350 - Release Date: 1/2/2004
 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Script within a script

2004-01-14 Thread Barbara Lindsey
you can make your script into a module and then call the module from
another  perl script.

 Is it possible to execute a perl script within another perl script?

 I have advertisements on many of my pages of my site that are randomly
 picked using a random ad script. I am creating some pages that are
 dynamically being created, and I can't use ssi to pull the ads into the
 page (right now on my main page I use !--#exec cgi -- to call the ad
 scripts.

 Thanks


 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.558 / Virus Database: 350 - Release Date: 1/2/2004



 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 http://learn.perl.org/ http://learn.perl.org/first-response




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: Script within a script

2004-01-14 Thread Charles K. Clarkson
Kenneth W. Craft MCP [EMAIL PROTECTED] wrote:
: 
: Is it possible to execute a perl script within another perl
: script?
: 
: I have advertisements on many of my pages of my site that
: are randomly picked using a random ad script. I am creating
: some pages that are dynamically being created, and I can't
: use ssi to pull the ads into the page (right now on my main
: page I use !--#exec cgi -- to call the ad scripts.

Are you dynamically creating the content or the structure
of the web page? If the structure remains the same, you could
call the dynamic content from SSI and leave the rest of the
page as is. This might have the additional benefit of possibly
allowing the design to change independent of the content.


HTH,

Charles K. Clarkson
-- 
Head Bottle Washer,
Clarkson Energy Homes, Inc.
Mobile Home Specialists
254 968-8328


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Clearing Arrays

2004-01-14 Thread Support
Hi
I do not want to continue this thread to bag other users, but I do have a 
number or perl books and it did take me some time to find out how to clear 
an array. From the replies I got (and I thank those who did reply) 
confirmed I was using ' @array=()' correctly. In the end, I found the 
problem that was giving me grief. This is a good forum to subscribe to. I 
save all my emails into a database (1,000s so far) so I can search back if 
I have a problem.
I did not find any reference to clearing arrays, hence my question to this 
forum.
Cheers
Colin

---
www.rentmyplace.co.nz
The ultimate in that holiday spot away from the maddening crowd
Join as a member today its FREE
List your holiday accommodation for FREE
 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: Clearing Arrays

2004-01-14 Thread Owen Cook

On Wed, 14 Jan 2004, Support wrote:

 confirmed I was using ' @array=()' correctly. In the end, I found the 
 problem that was giving me grief. This is a good forum to subscribe to. I 
 save all my emails into a database (1,000s so far) so I can search back if 
 I have a problem.


If you have access to a news browser, you can go to nntp.perl.org and
subscribe to this group. There is 2 posts there

If you have access to a browser, you can search google groups
perl.beginners 

Also newsgroup comp.lang.perl.misc is worthy of subscription as are a few
other perl groups depending on your interests

Its all out there


Owen


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: redirect with cgi.pm

2004-01-14 Thread Jan Eden
Hi,

like this:

#!/usr/bin/perl -w

use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser);

my $q = new CGI;

print $q-header
# do this - do that, using $q

print $q-redirect(/thanks.html);

- Jan

jdavis wrote:

Hello,
 I have been able to use redirects with cgi.pm as long 
as the redirect is the only thing in the script.

i.e.
#!/usr/bin/perl
use CGI qw(:standard);
print redirect('http://google.com/');


but what i need to do is print a bunch of html , have perl do
a few jobs on my system, and then do a redirect when its done.

is this possible?

thanks,
-- 
jdavis [EMAIL PROTECTED]


-- 
Common sense is what tells you that the world is flat.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




check whether file is ascii or ebcdic

2004-01-14 Thread nntp.perl.org
Hi

How do I check whether a file is in ebcdic or ascii format ?

Thanks,
Nitish



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: RFC: Package == class == object type

2004-01-14 Thread Gary Stainburn
On Tuesday 13 Jan 2004 5:05 pm, Wiggins d Anconia wrote:
  On Tuesday 13 Jan 2004 3:04 pm, James Edward Gray II wrote:
   On Jan 13, 2004, at 6:24 AM, Gary Stainburn wrote:

 snip

  I could reverse the parameter sequence so that the block type is

 first, then

  allow multiple block names to be specified, thus reducing the work

 involved.

  I'll probably make it so that it creates the links between the blocks
  too.

 big snip

 THis is the one point that I was going to remark on earlier. As your
 system and objects, etc. become more complex there is a good chance you
 are going to find that using a flat list as method parameter passing is
 a nightmare, you may want to consider passing arguments in a named list
 manner, so that they can be unordered, optional, etc. This adds to the
 complexity of argument verification but in the long run adds flexibility
 to the interface. Some examples:

 my $object = new Class (value 1, value 2, value 3);

 In the above the new constructor takes three values that *must* be in
 the proper order (unless their type can be gleaned in other ways such as
 with ref or isa) and must all exist. For instance if you didn't need nor
 have 'value 2' you still must specify a place holder, like:

 my $object = new Class (value 1, undef, value 3);

 etc. Which makes the interface less flexible in the future, and harder
 to remember how it may(must) be used.  I tend to advocate named
 parameter passing such as,

 my $object = new Class (key1 = value 1, key2 = value 2, key3 =
 value 3);

 Then when value 2 is needed or isn't known simply drop the key/value
 pair and nothing else in the method should need changing, assuming it
 wasn't required before.

 Certainly there are times when an interface needs to be simple and isn't
 likely to expand greatly, or a particular argument must *always* be
 provided, in which case this may be overkill but I thought I would
 mention it. Using named parameters may also make it easier to pass
 lists, which need to be passed as references, in which case explicitly
 naming them may help on both sides of the interface.

 As a side note to the list, I posted a message to Gary (trying to
 prevent the previous thread from becoming cluttered, which it has now
 anyways :-)) stating that I think his application (aside from the real
 time need) is perfectly suited for experiments into POE. The
 description of the system's needs jive exactly with what POE was meant
 to handle...

 http://danconia.org

Hi,

I've not responded to these two comments yet as my head was struggling enough 
with the read of the thread.

I've looked at POE before, and at the time thought it looked far too 
complicated.  However, looking again now may produce a different opinion.  I 
still think that it will be a bit OTT for my project.

The idea of named parameters is worth considering as my project and therefore 
the methods is starting to get far more comprehensive and complex.

Gary
-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: check whether file is ascii or ebcdic

2004-01-14 Thread Ramprasad A Padmanabhan
Nntp.Perl.Org wrote:
Hi

How do I check whether a file is in ebcdic or ascii format ?

Thanks,
Nitish

perldoc -f -x

That tells me how to find if a file is ascii text

if(-T $file) {
  print $file is an ascii text file \n;
} else {
   print Not an ascii text file \n;
}


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Regular Expressions

2004-01-14 Thread Lukas Schneider
Hi ,

I’ve a question to the regular expressions:

Is it possible to formulate a pattern to find all blocks with a length of x,

which contain y repeats of defined characters?
e.g. let’s say: find 4 Leucins in a segment with the length of 6?

Many thanks...



-- 
+++ GMX - die erste Adresse für Mail, Message, More +++
Neu: Preissenkung für MMS und FreeMMS! http://www.gmx.net



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: check whether file is ascii or ebcdic

2004-01-14 Thread nntp.perl.org
 
  How do I check whether a file is in ebcdic or ascii format ?
 
  Thanks,
  Nitish
 
 
 perldoc -f -x

 That tells me how to find if a file is ascii text

 if(-T $file) {
print $file is an ascii text file \n;
 } else {
 print Not an ascii text file \n;
 }

is there any way to tell if a file is ebcdic text ?



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: check whether file is ascii or ebcdic

2004-01-14 Thread nntp.perl.org
  Hi
 
  How do I check whether a file is in ebcdic or ascii format ?
 
  Thanks,
  Nitish
 
 
 perldoc -f -x

 That tells me how to find if a file is ascii text

 if(-T $file) {
print $file is an ascii text file \n;
 } else {
 print Not an ascii text file \n;
 }


Is there any way to explicitly check if a file is EBCDIC ?



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: redirect with cgi.pm

2004-01-14 Thread James Edward Gray II
On Jan 14, 2004, at 3:25 AM, Jan Eden wrote:

Hi,

like this:

#!/usr/bin/perl -w

use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
my $q = new CGI;

print $q-header
# do this - do that, using $q
print $q-redirect(/thanks.html);
Unfortunately, this doesn't work.  As Randal already said, it's not 
possible to do both.  You either print a page, or redirect to another 
page.  Here's a quote from CGI.pm POD:

  print $query-redirect('http://somewhere.else/in/movie/land');

   Sometimes you don't want to produce a document yourself, but 
simply
   redirect the browser elsewhere, perhaps choosing a URL based on 
the
   time of day or the identity of the user.

   The redirect() function redirects the browser to a different 
URL.  If
   you use redirection like this, you should not print out a header 
as
   well.

Hope that helps.

James

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: Problem with dereferencing of $_

2004-01-14 Thread Rob Dixon


Duan Toh wrote:

 testing the use of DBI. Having a problem (highlighted in red) with using
 @$_ as the topic. When I use @row the program writes records as
 expected to test.txt but when I use the topic it only writes ...
 
 
 
 in the file.  I have reread documentation to see if I am using @$_
 correctly and it seems OK to me can anyone help ?

We can receive only plain text on this group: coloured highlighting
doesn't work. You must mark your program in a different way.

 use warnings;
 use strict;

 use DBI;
 use Data::Dumper;

 my $destination = test.txt;
 my $dbh = DBI-connect( dbi:ODBC:Northwind, , ,
 {RaiseError = 1, PrintError = 1, AutoCommit = 1} ) or
 die Unable to connect:  . $DBI::errstr . \n;

 open OUTPUT, $destination or die $!;

 # OK, connected, now select from Customers table.

 my $sel = $dbh-prepare( select CustomerID,CompanyName,Country from
 Customers where CustomerID like ? );

 $sel-execute( qq{%} );

 if ($ARGV[0]) {
 while ($sel-fetchrow_array) {
 print OUTPUT '';
 print OUTPUT join ',', map {$_||0} @$_;
 print OUTPUT '',\n;
 }
 }
 else {
 while (my @row = $sel-fetchrow_array) {
 print OUTPUT '';
 print OUTPUT join ',', map {$_||0} @row;
 print OUTPUT '',\n;
 }
 }

The fetchrow_array method returns a list of data. In the first part of the 'if'
statement you're throwing that list away - nothing's being assigned to $_. In the
second part you're copying the list into array @row, so it should work fine.

Dereferencing $_ as an array with @$_ will work only if $_ holds an array
reference. You could rewrite the first loop as

  while ($_ = $sel-fetchrow_arrayref) {
print OUTPUT '';
print OUTPUT join ',', map {$_||0} @$_;
print OUTPUT '',\n;
  }

which will work because the fetchrow_arrayref method returns an array reference
and it's being stored in $_. Using $_ is only useful if there are several
operations to be done on the value that can take $_ as a default parameter. In
this case you have no such operations and you would be better off writing

  while (my $row = $sel-fetchrow_arrayref) {
print OUTPUT '';
print OUTPUT join ',', map {$_||0} @$row;
print OUTPUT '',\n;
  }

HTH,

Rob



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: strange sort order

2004-01-14 Thread Rob Dixon
Dan Laflamme wrote:

 I have a file that appears to be somewhat sorted, but is not sorted
 according to the traditional unix sort. I'll give some examples, and if
 anyone recgonizes the way in which the file is sorted, please let me
 know. Also, since I may have to write a comparator function for use on
 this sorted file, any tips on doing that in the most efficient way
 possible would be helpful. Thanks.

 Examples. I give some sets of strings to indicate which comes before the
 other in the sorted file. The first one in each pair is less than the
 second. Each set is independent of the others. set x doesnt necessarily
 come before set y in the file if x  y.

 Set 1:
 0-CELEBRITY-0
 0-CELEBRITY

 Set 2:
 0-0-7
 0-0

 Set 3:
 000-AAA
 000

 Set 4:
 000
 

 Set 5:
 0908
 09088122595
 09088122595
 0909-114

We could make guesses as to the sort algorithm, but there is very little data
here to go on. If you sort stringwise on the first fragment of the string up to
the dash then you will get exactly this order. But several strings have the same
first fragment (all of Set 1 and Set 2, for instance, start with the value '0').

Do you have access to the sort operation so that you can sort arbitrary data?
This can be decided properly only by seeing how contrived test data is sorted.

Rob



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: RFC: Package == class == object type

2004-01-14 Thread Wiggins d Anconia
 On Tuesday 13 Jan 2004 5:05 pm, Wiggins d Anconia wrote:
   On Tuesday 13 Jan 2004 3:04 pm, James Edward Gray II wrote:
On Jan 13, 2004, at 6:24 AM, Gary Stainburn wrote:

snip old posts

 
 Hi,
 
 I've not responded to these two comments yet as my head was struggling
enough 
 with the read of the thread.


No problem, lots to take in, but good information...
 
 I've looked at POE before, and at the time thought it looked far too 
 complicated.  However, looking again now may produce a different
opinion.  I 
 still think that it will be a bit OTT for my project.
 

It is pretty complicated, the tough part is that so is your project ;-)!
As the others have expressed.  I am concerned (take that loosely) that,
while your attempts to learn OOP in this context are certainly
worthwhile and giving you progress, the OOP may be hiding the
complicated part of your problem that is yet to come which has been
mentioned briefly before. In other words how do you keep the parts of
the system running in a constant nature while attempting to receive
inputs from external sources in possibly multiple ways.  The problem I
foresee is that you have multiple objects that are all possibly
(usually?) doing something independently but also must detect and handle
signals from other objects in some unscheduled manner which is fine to
say, but the problem becomes that a single Perl process *blocks*
(usually), which essentially means your objects can't work independently
and concurrently. In more concrete terms, you have to have a way to have
a train move along a track, have a signal box receiving signals, having
 a trainset manager (can't remember the name you gave it) inputting data
(aka using the controls), having the controls waiting for inputs and
handling them, etc. *at the same time* all the while with some way to
get the various parts talking while they work.  The problem becomes how
to do this, how to prevent the blocking, three options come to mind (for
me) threads, forked separate processes (using IPC or shared memory
(yikes)), or some type of time slicing aka POE, Select, or Loop (group
have I missed any?).  I am curious if the discussion about the owner
and managing all of those tasks is the reason why the object structure
hasn't been as obvious as it should.  Essentially this is the jump that
must be made from simple scripts to long running programs, essentially a
server, where rather than serving data of some sort you are really
serving trainset events (which of course is just data), then a client
plugs in to control those events.  I am thinking that you can resolve
your object system and make it seem like it will work, but when you go
to flip the on switch it is just going to sit there because how to get
the different parts moving hasn't been worked out fully in the design,
that or you will have a series of events that must happen in the
essentially in the same order at the same time, which is hardly like the
real life system you are trying to emulate.  But then I could just be
off my rocker in the end if I am not loco, POE is going to be one
easy way to get this type of system running.

 The idea of named parameters is worth considering as my project and
therefore 
 the methods is starting to get far more comprehensive and complex.
 

Yeh, its extra work to get used to but worth it in the end...

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: redirect with cgi.pm

2004-01-14 Thread Wiggins d Anconia
 On Jan 14, 2004, at 3:25 AM, Jan Eden wrote:
 
  Hi,
 
  like this:
 
  #!/usr/bin/perl -w
 
  use strict;
  use CGI;
  use CGI::Carp qw(fatalsToBrowser);
 
  my $q = new CGI;
 
  print $q-header
  # do this - do that, using $q
 
  print $q-redirect(/thanks.html);
 
 Unfortunately, this doesn't work.  As Randal already said, it's not 
 possible to do both.  You either print a page, or redirect to another 
 page.  Here's a quote from CGI.pm POD:
 
print $query-redirect('http://somewhere.else/in/movie/land');
 
 Sometimes you don't want to produce a document yourself, but 
 simply
 redirect the browser elsewhere, perhaps choosing a URL based on 
 the
 time of day or the identity of the user.
 
 The redirect() function redirects the browser to a different 
 URL.  If
 you use redirection like this, you should not print out a header 
 as
 well.
 
 Hope that helps.
 
 James

While this is good documentation and in the end does the right thing,
the part I don't like about it is when it reads:

You should not print out a header *as well*.

The problem is that, as well, implies that a header hasn't been
printed, but the fact is that the redirect is a header, or more
precisely is a line of the overall header, and one that specifically (at
least by today's browsers and the HTTP protocol itself) indicates that
there won't be a content type and data coming.  So it isn't that you
can't print multiple headers, but that the client only respects the
first, so you can't print one, have it interpreted, then print another,
and have it interpreted as well.  The difficult part is that the docs
are written by people who understand the protocol, and back in the day
most developers understood the protocol because HTTP was new and the
client/server model was older so the statement should be obvious (to the
point of not needing it), now days many web developers don't even know
that there is a protocol, let alone anything specific about it, so what
shouldn't need to be there becomes obvious, but the fact that it needs
to be there indicates that there needs to be more description along with
it...

Boy, apparently I am in a rambling mood...

http://danconia.org


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




threads in perl

2004-01-14 Thread Igor Ryaboy
Hi All!

I am running a multithread program and threads may stuck. I need to be able to 
terminate those threads after some defined period of time. I can't use a detach 
because I don't want to leave this thread run forever and I can't use join because the 
thread never ends. Any ideas? Please help :)

Igor

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




== eq gt

2004-01-14 Thread Paul Kraus
I understand that the eq and gt are for string comparisons but why not just
use the mathematical ones of == or . This goes for functions open ... or
compared to open .. ||

 Paul Kraus
 ---
 PEL Supply Company
 Network Administrator
 ---
 800 321-1264 Toll Free
 216 267-5775 Voice
 216 267-6176 Fax
 www.pelsupply.com
 ---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response


RE: redirect with cgi.pm

2004-01-14 Thread Dan Muey

 
 Hi,
 
 like this:
 
 #!/usr/bin/perl -w
 
 use strict;
 use CGI;
 use CGI::Carp qw(fatalsToBrowser);
 
 my $q = new CGI;
 
 print $q-header
 # do this - do that, using $q
 
 print $q-redirect(/thanks.html);
 
 - Jan

redirect() does a header like header(), the first header 
that gets sent is the header, the rest is content, even if 
The contetn looks just like a header.

If you run that in a browser you'll probably see Location: /thanks.html 
in your screen. Since that is content for the header() you did above it. 
Make sense? I also remember hearing it's a better idea to use absolute 
url's in your Location header.

HTH

DMuey
 
 jdavis wrote:
 
 Hello,
  I have been able to use redirects with cgi.pm as long
 as the redirect is the only thing in the script.
 
 i.e.
 #!/usr/bin/perl
 use CGI qw(:standard);
 print redirect('http://google.com/');
 
 
 but what i need to do is print a bunch of html , have perl do a few 
 jobs on my system, and then do a redirect when its done.
 
 is this possible?
 
 thanks,
 --
 jdavis [EMAIL PROTECTED]
 
 
 -- 
 Common sense is what tells you that the world is flat.
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED] 
http://learn.perl.org/ http://learn.perl.org/first-response



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: threads in perl

2004-01-14 Thread Igor Ryaboy
Hi,
(Please ignore the previous mail.)
In this example this fellow detaches all useless threads. In my case this is not an 
option , because a detached thread never ends. For correct thread managing it is 
enough to remove the detached thread from the list but the process will still run. I 
need to kill the process! (Verilog simulation in my case) 
Thanks,
Igor

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of zentara
Sent: Wednesday, January 14, 2004 5:28 PM
To: [EMAIL PROTECTED]
Subject: Re: threads in perl


On Tue, 13 Jan 2004 17:17:20 +0200, [EMAIL PROTECTED] (Igor
Ryaboy) wrote:

Hi All!

I am running a multithread program and threads may stuck. I need to be able to 
terminate those threads after some defined period of time. I can't use a detach 
because I don't want to leave this thread run forever and I can't use join because 
the thread never ends. Any ideas? Please help :)

Igor

Yeah, a fellow posting on perlmonks.org just did a nice job of this
using threads::shared and sending some kill signals thru shared
variables.  It is a multi-threaded chat server, and he had a similar
problem, killing off detached threads.
It is quite long, but it works. Here is the url. I hope it may give you
some ideas. 

http://perlmonks.org/index.pl?replies=1node_id=319769displaytype=print



--
When life conspires against you, and no longer floats your boat,
Don't waste your time with crying, just get on your back and float.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: == eq gt

2004-01-14 Thread James Edward Gray II
On Jan 14, 2004, at 9:34 AM, Paul Kraus wrote:

I understand that the eq and gt are for string comparisons but why not 
just
use the mathematical ones of == or .
Because we want Perl to magically convert our variables to whatever we 
currently mean (number or string) without making us jump through hoops 
like casting them.  The only way that's possible is if Perl knows 
what we currently mean.  Operators like + and . are pretty easy to 
infer meaning from, but when we ask is this the same as this Perl 
need to know how we're comparing since 0.0 ne 0 but 0.0 == 0.

This goes for functions open ... or compared to open .. ||
or vs. || is all about precedence.  We want that or die part at the 
end to happen dead last, so we need a super low precedence operator 
(or).  With a higher precedence operator (||) Perl thinks we mean use 
this or this as the last parameter to open().  Since the last 
parameter is usually going to be a true string, the die never gets 
called and even if it did, it wouldn't be under the right 
circumstances.  If you use parenthesis around open()'s parameters, the 
confusion is removed and you may use whichever you prefer.

As an added perk:

open FILE, 'some_file.txt' or die File error:  $!;

is clean and reads pretty much like English.  Some of us geeks like 
that.

James

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



RE: redirect with cgi.pm

2004-01-14 Thread Jan Eden
print $q-header # do this - do that, using $q

print $q-redirect(/thanks.html);

redirect() does a header like header(), the first header that gets
sent is the header, the rest is content, even if The contetn looks
just like a header.

Thanks for the correction, I have not found the time to read CGI
Programming with Perl thoroughly and did not realize redirect *does*
a header.

I also remember hearing it's a better idea to use absolute url's in your Location 
header.

Regarding this, I am proud of keeping all of my relative links intact. It's sort of a 
challenge. At least I use absolute relative links instead of entirely relative ones. 
;-)

Best,

Jan
-- 
There are 10 kinds of people:  those who understand binary, and those who don't

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: == eq gt

2004-01-14 Thread Jan Eden
Because the following has different return values:

beta  alpha (is false)
beta gt alpha (is true)

alpha eq alpha (is true)
alpha == alpha (is ... I don't know, undef maybe?)

For || and or, they have different precedence rankings (so you have to adjust your 
bracketing when exchanging them).

- Jan

Paul Kraus wrote:

I understand that the eq and gt are for string comparisons but why not just
use the mathematical ones of == or . This goes for functions open ... or
compared to open .. ||
-- 
These are my principles and if you don't like them... well, I have others. - Groucho 
Marx

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Emacs Wizards

2004-01-14 Thread Paul Kraus
Is there a way to easily have emacs comment out xnumber of lines.

If  something{
Then do
Else
Do 
}

Alt 5 Ctrl - somecoolsequence I don't know

#If  something{
#   Then do
#Else
#   Do 
#}


Sort of perl related assuming you hackers are using 'real editor' :)

 Paul Kraus
 ---
 PEL Supply Company
 Network Administrator
 ---
 800 321-1264 Toll Free
 216 267-5775 Voice
 216 267-6176 Fax
 www.pelsupply.com
 ---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response


RE: decoding a base64 file?

2004-01-14 Thread Dan Muey

 Hello folks,
 
 If I encode a file with MIME::Base64 with the following 
 script, encode_base64.pl. The 
 
 question is; how do I decode the file?  I use the following 
 script, decode_base64.pl to 
 
 decode back to the original source but that did not work.
 
 Thank you...

[snip]

while (read(FILE_R, $buf, 60*57 )) {
$encoded = MIME::Base64::decode($buf);
print FILE_W $encoded ;

}  

Try decodeing the entire encoded data instead of a line at a time.
HTH

DMuey

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: redirect with cgi.pm

2004-01-14 Thread Dan Muey
 redirect() does a header like header(), the first header 
 that gets sent 
 is the header, the rest is content, even if The contetn 
 looks just like 
 a header.
 
 Thanks for the correction, I have not found the time to read 
 CGI Programming with Perl thoroughly and did not realize 
 redirect *does* a header.
 

No problem.

 I also remember hearing it's a better idea to use absolute url's in 
 your Location header.
 
 Regarding this, I am proud of keeping all of my relative 
 links intact. It's sort of a challenge. At least I use 
 absolute relative links instead of entirely relative ones. ;-)
 

Whatever you want, but it's more likely to cause a browser to choke, 
which would kind of defeat the purpose that's all. And that's not just 
true with Perl it's the http protocol and a browser's use of it.

 Best,
 
 Jan
 -- 
 There are 10 kinds of people:  those who understand binary, 
 and those who don't
 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: == eq gt

2004-01-14 Thread Daniel Staal
--As off Wednesday, January 14, 2004 10:34 AM -0500, Paul Kraus is 
alleged to have said:

I understand that the eq and gt are for string comparisons but why
not just use the mathematical ones of == or . This goes for
functions open ... or compared to open .. ||
--As for the rest, it is mine.

Because a string isn't a number.

Sure, you can treat a string as a number, or a series of numbers, 
based on the ASCII values.  But that leads to weirdness and 
confusion.

For example: The best numeric representation of a string is a 
_series_ of (ASCII/UTF8/etc) numbers.  The numeric comparison 
operators work on  one number on each side.  So, how do you convert a 
string to a single number?  Do you add the array together, or work on 
the first only, or something else?

Ok, so your next objection is that the operator should just know 
which you mean (numeric or string) and compare using the correct 
metric.  Except, on occasion, you _want_ to compare two strings as if 
they were numbers.  Perl will let you do that.  (Even if 'use 
warnings' will tell you not to.)

As for or vs ||...  That is more of a precedence issue at the moment. 
Note that open ... or would _not_ do the same as open ... ||: The 
latter would do the comparison before the open.  This could be 
useful: you could make the choice of what to open right then.  But it 
wouldn't be the open ... or die trick we all know and love: for that 
the open has to be tried first.

In conclusion, Perl has seeming duplicates often because they aren't 
duplicates, just near-duplicates.  Sure, the language could get by 
with just one.  It would just be more work for the programmers.

But why do the programmers want to work?

Daniel T. Staal

---
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: Emacs Wizards

2004-01-14 Thread drieux
On Jan 14, 2004, at 8:07 AM, Paul Kraus wrote:

Sort of perl related assuming you hackers are using 'real editor' :)
real coders of course would do

	:.,5s/^/#/

because we are not afraid of vi.

8-)

Or if we are using our bbedit it is some
find and replace with grep using the selected
region only or in 
ciao
drieux
---

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: Upgrading Perl linux 5.6 rpm to 5.8.2 source

2004-01-14 Thread denis

Have you tried:

rpm -ivh perl_rpm_name?

This should allow you to do an upgrade rather then remove and upgrade.

HTH.. Denis

On Tue, 13 Jan 2004, Paul Kraus wrote:

 On a Linux system how can I remove the 5.6 rpm and then install the 5.8.2
 from source and still maintain dependencies? If something is looking for
 perl how do I make sure that it upgrades correctly?
 
  Paul Kraus
  ---
  PEL Supply Company
  Network Administrator
  ---
  800 321-1264 Toll Free
  216 267-5775 Voice
  216 267-6176 Fax
  www.pelsupply.com
  ---
 
 
 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Emacs Wizards

2004-01-14 Thread Daniel Staal
--As off Wednesday, January 14, 2004 8:29 AM -0800, drieux is alleged 
to have said:

Or if we are using our bbedit it is some
find and replace with grep using the selected
region only or in 
--As for the rest, it is mine.

Actually, in BBEdit it is Tools-Un/Comment.  No shortcut key by 
default, but you can assign one.

Sorry I can't help with EMacs...

Daniel T. Staal

---
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



perl loan scripts/software

2004-01-14 Thread Joe Echavarria
Hi there,

  I need to find out if there is a perl software,
script for loans managament.  Is for a client that 
give loans to their customers and want to have control
over the payments, the interest receive, etc.
  Does anyone knows about any  perl software for like
that ?

   Thanks.

__
Do you Yahoo!?
Yahoo! Hotjobs: Enter the Signing Bonus Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: perl loan scripts/software

2004-01-14 Thread Dan Muey
 Hi there,
 
   I need to find out if there is a perl software,
 script for loans managament.  Is for a client that 
 give loans to their customers and want to have control
 over the payments, the interest receive, etc.
   Does anyone knows about any  perl software for like
 that ?

Do you mean a calculator type script or a whole loan 
document generator, tracker, customer db manager?

 
Thanks.
 
 __
 Do you Yahoo!?
 Yahoo! Hotjobs: Enter the Signing Bonus Sweepstakes 
 http://hotjobs.sweepstakes.yahoo.com/signingbo nus
 
 -- 
 To 
 unsubscribe, e-mail: 
 [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED] 
http://learn.perl.org/ http://learn.perl.org/first-response



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: redirect with cgi.pm

2004-01-14 Thread jdavis
Thanks all who replied. From your post i gather that i need 
to handle my redirect client sideso.

#!/usr/bin/perl
use CGI qw(:standard);
print header;
 
$| = 1;
 
print hi\n;
sleep 3; # i would actually do a lot of other stuff here
 
printEOF
script language=javascript
!--
 
location.replace(http://www.yahoo.com;);
 
--
/script
 
EOF

thanks,
jd




On Wed, 2004-01-14 at 09:09, Dan Muey wrote:
  redirect() does a header like header(), the first header 
  that gets sent 
  is the header, the rest is content, even if The contetn 
  looks just like 
  a header.
  
  Thanks for the correction, I have not found the time to read 
  CGI Programming with Perl thoroughly and did not realize 
  redirect *does* a header.
  
 
 No problem.
 
  I also remember hearing it's a better idea to use absolute url's in 
  your Location header.
  
  Regarding this, I am proud of keeping all of my relative 
  links intact. It's sort of a challenge. At least I use 
  absolute relative links instead of entirely relative ones. ;-)
  
 
 Whatever you want, but it's more likely to cause a browser to choke, 
 which would kind of defeat the purpose that's all. And that's not just 
 true with Perl it's the http protocol and a browser's use of it.
 
  Best,
  
  Jan
  -- 
  There are 10 kinds of people:  those who understand binary, 
  and those who don't
  
-- 
jdavis [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




logrotate on Win32?

2004-01-14 Thread Michael Weber
Good morning!

Does anyone know if there exists a module like Logfile::Rotate that works on Win32 
platforms?  I am looking for something to rotate logs under Oracle, and I need some 
pretty fine control to pull it off and still have Oracle happy.  

Reinventing the wheel is definately not my first choice.

Thanx!

-Michael


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: redirect with cgi.pm

2004-01-14 Thread James Edward Gray II
On Jan 14, 2004, at 11:07 AM, jdavis wrote:

Thanks all who replied. From your post i gather that i need
to handle my redirect client sideso.
#!/usr/bin/perl
use CGI qw(:standard);
print header;
$| = 1;

print hi\n;
sleep 3; # i would actually do a lot of other stuff here
printEOF
script language=javascript
!--
location.replace(http://www.yahoo.com;);

--
/script
EOF
If you're going with something like that, use a META refresh tag, 
instead of having the script sleep.

James

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: Emacs Wizards

2004-01-14 Thread Jeff Westman
Paul Kraus [EMAIL PROTECTED] wrote:

 Is there a way to easily have emacs comment out xnumber of lines.
 
 If  something{
   Then do
 Else
   Do 
 }
 
 Alt 5 Ctrl - somecoolsequence I don't know
 
 #If  something{
 # Then do
 #Else
 # Do 
 #}
 
 Sort of perl related assuming you hackers are using 'real editor'
 :)

Something like

ESC 5 ESC x replace-regexp enter ^ enter #

should work (key sequence would be shorter if you have
replace-regexp defined in a global keyset.

(I love emacs, but vi is my tool of choice day-to-day ... much
quicker  vim is even better if you have it)

HTH

-Jeff

__
Do you Yahoo!?
Yahoo! Hotjobs: Enter the Signing Bonus Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




DProf and Win32

2004-01-14 Thread mcdavis941
Hi, Can anyone tell me about using DProf on Win32 and to what extent I can expect 
meaningful results at all.

I'm looking at the following output from DProf and it looks suspect.  I'm guessing 
this has to do with the lack of a high-resolution timer.

For example: 

- elapsed time is negative?
- exclusive seconds greater than cumulative seconds?
- all percentages zero?

Or am I just looking at this wrong?  TIA.

From dprofpp:


Total Elapsed Time = -361.860 Seconds
  User+System Time =0 Seconds
Exclusive Times
%Time ExclSec CumulS #Calls sec/call Csec/c  Name
 0.00   192.2 57.757 610981   0.0003 0.0001  DetectionRuleClass::match_on_rule
 0.00   102.4 12.246 747419   0.0001 0.  main::chkargcnt
 0.00   39.93 57.899   2359   0.0169 0.0245  DetectionRuleListClass::match_on_rule_old
 0.00   4.739  0.179  18541   0.0003 0.  main::unslashname
 0.00   4.222  0.052  15476   0.0003 0.  main::slashname
 0.00   2.876  0.150   4758   0.0006 0.  main::disambiguateplayername
 0.00   2.170  0.404   7481   0.0003 0.0001  PersonListClass::exists
 0.00   1.927  0.587   4974   0.0004 0.0001  MasterDataSetClass::synonymousperson_100
 0.00   1.832  0.288   6095   0.0003 0.  AbbrevClass::person
 0.00   1.574  1.998  1   1.5744 1.9979  main::readrawdatafile
 0.00   1.533  0.368   5488   0.0003 0.0001  main::isvalidname
 0.00   1.443  0.044   5112   0.0003 0.  PersonClass::name
 0.00   1.394  0.266   3868   0.0004 0.0001  DetectionRuleClass::nameisa
 0.00   1.344  0.418   4111   0.0003 0.0001  DetectionRuleClass::name
 0.00   1.254  0.263   3655   0.0003 0.0001  DetectionRuleClass::rule


__
New! Unlimited Netscape Internet Service.
Only $9.95 a month -- Sign up today at http://isp.netscape.com/register
Act now to get a personalized email address!

Netscape. Just the Net You Need.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: redirect with cgi.pm

2004-01-14 Thread jdavis
On Wed, 2004-01-14 at 10:19, James Edward Gray II wrote:
 On Jan 14, 2004, at 11:07 AM, jdavis wrote:
 
  Thanks all who replied. From your post i gather that i need
  to handle my redirect client sideso.
 
  #!/usr/bin/perl
  use CGI qw(:standard);
  print header;
 
  $| = 1;
 
  print hi\n;
  sleep 3; # i would actually do a lot of other stuff here
 
  printEOF
  script language=javascript
  !--
 
  location.replace(http://www.yahoo.com;);
 
  --
  /script
 
  EOF
 
 If you're going with something like that, use a META refresh tag, 
 instead of having the script sleep.
 
 James

the real script will not use sleep, was just a test to emulate
some work being done.
-- 
jdavis [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: STDIN and STDOUT on Windows

2004-01-14 Thread Peter Kay
[EMAIL PROTECTED] (Rob Dixon) wrote:

 We Unix people find we Windows people very strange
:)
...
   test.pl  test.txt
 and
   type test.txt | perl test.pl
 
 are just two (increasingly weird) versions of
 
   perl test.pl test.txt
 

We Unix people want to rip out the operating system
some times!  I don't know what this post is even doing
in [EMAIL PROTECTED] - it's been enough to make my
head swim for a while.

For the record, test.pl  test.txt won't work - you
need:
perl test.pl  test.txt

Just when you think Perl on Windows is more or less
normal, you get something like this thrown at you...

Peter


__
Do you Yahoo!?
Yahoo! Hotjobs: Enter the Signing Bonus Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: Upgrading Perl linux 5.6 rpm to 5.8.2 source

2004-01-14 Thread Guay Jean-Sébastien

 This should allow you to do an upgrade rather then remove and upgrade.

If it's possible to do that (and have it actually work), does that mean that
it's only on Windows (with ActiveState Perl) that Perl 5.6 and 5.8 are not
binary compatible for XS modules? If not, I would think that simply
upgrading Perl and not all the other modules you have installed would
seriously bork the install...

Honestly, I didn't know that was just an ActiveState thing.

J-S

__
Jean-Sébastien Guay
Conseiller
 Service des cartes de débit et guichets
 Services électroniques - Direction 499
 Banque Laurentienne du Canada
 Tél: 514.522.9800 poste 4840
 Utilisez nos services BLCDirect :  http://www.banquelaurentienne.com 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: threads in perl

2004-01-14 Thread david
Igor Ryaboy wrote:

 Hi,
 (Please ignore the previous mail.)
 In this example this fellow detaches all useless threads. In my case this
 is not an option , because a detached thread never ends. 

this is plain wrong.

 For correct thread managing it is enough to remove the detached thread
 from the list but the process will still run. I need to kill the process! 
 (Verilog simulation in my case) Thanks, Igor

i don't know what you are asking for. do you want to kill the process and 
have all the threads gone? or do you want to kill the threads but still 
have the process running?

david
-- 
sub'_{print@_ ;* \ = * __ ,\  \}
sub'__{print@_ ;* \ = * ___ ,\  \}
sub'___{print@_ ;* \ = *  ,\  \}
sub'{print@_,\n}{_+Just}(another)-(Perl)-(Hacker)

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: check whether file is ascii or ebcdic

2004-01-14 Thread Peter Scott
In article [EMAIL PROTECTED],
 [EMAIL PROTECTED] (Nntp.Perl.Org) writes:
Hi

How do I check whether a file is in ebcdic or ascii format ?

It rather depends on what you mean by 'ASCII'.  If you were referring
to strict ASCII, the 8th bit would be clear and so, assuming you are
talking about text files, you would look to see whether the 8th bit
was used much, because most printable characters in EBCDIC have the
8th bit set.

However, the picture is a bit muddied by the fact that there are 
character set extensions to ASCII that set the 8th bit.  So the
mere presence of a set 8th bit doesn't rule out ASCII.  

I suggest you do some tests on samples of the kinds of files you'll
be dealing with and print out the percentage of characters they
contain that has the 8th bit set, and look at the ASCII vs EBCDIC
ones.  Hopefully a clear pattern will emerge.

-- 
Peter Scott
http://www.perldebugged.com/
*** NEW *** http//www.perlmedic.com/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE:Apel of VIM was Emacs Wizards

2004-01-14 Thread Paul Kraus
 (I love emacs, but vi is my tool of choice day-to-day ... much
 quicker  vim is even better if you have it)
 Why? I started with emacs just because it happened to be the 1st I heard
about. Since you know both why does vim appeal to you over emacs? Other then
size.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




is this sound?

2004-01-14 Thread Eric Walker
Hey guys/girls,
I want to make a list of structures from a file.  Then once I get the
structures check to see if a particular value matches any in the list of
structurs that I have created.  If there is a match then return the
pointer to the matching structure.  Check the code below and let me know
if I am on the write track.  Assuming I am creating object and calling
the method correctly.


sub new {
my ($class,$rulenumber,$value,$type,$value,$comment) = @_;
$class = $_[0];
my $r_section = {   #creates unique object
Rulenumber = $rulenumber,
Type   = [a,b,c],
Value  = $value,
Comment= $comment,
};
return bless ($r_section,$class);#returns object
}

sub find {
   my ($self,$r_Obj,$rule) = @_;
   #$r_Obj is a pointer to an array of pointers that were created from
routine above
#$rule is the rule I am looking for.
   
   foreach $item ($r_Obj){
if($rule eq $item-{'Rulenumber'}){
return($item); #This will return a matching rulenumber
}#endif
 }#endfor
}#endsub


Thanks
Perlknucklehead




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




omg, spelling

2004-01-14 Thread Eric Walker
please disregard the spelling errors...


perlknucklehead





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Upgrading Perl linux 5.6 rpm to 5.8.2 source

2004-01-14 Thread drieux
On Jan 14, 2004, at 10:33 AM, Guay Jean-Sébastien wrote:

This should allow you to do an upgrade rather then remove and upgrade.
If it's possible to do that (and have it actually work), does that 
mean that
it's only on Windows (with ActiveState Perl) that Perl 5.6 and 5.8 are 
not
binary compatible for XS modules? If not, I would think that simply
upgrading Perl and not all the other modules you have installed would
seriously bork the install...
[..]

two different issues.

the upgrade will upgrade and install the
XS compatible for 5.8.X version of the code
for all of the components that are in the RPM.
any additional perl modules that have an XS component
will need to be re-built and installed.
ciao
drieux
---

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



RE: Upgrading Perl linux 5.6 rpm to 5.8.2 source

2004-01-14 Thread Guay Jean-Sébastien
Hello drieux,

 the upgrade will upgrade and install the
 XS compatible for 5.8.X version of the code
 for all of the components that are in the RPM.
 
 any additional perl modules that have an XS component
 will need to be re-built and installed.

Exactly, that's what I was wondering about... Since the OP mentioned this in
his original message :

 [...] and still maintain dependencies? [...]

Which I interpreted as without being forced to reinstall all my modules
which are not part of the standard Perl distribution. So you confirm that
that isn't possible, and that any modules that contain XS code and which
were not part of the 5.8 RPM will have to be recompiled or otherwise
reinstalled from a 5.8-compatible source (CPAN, RPMs, etc.)?

I am also asking for my personal benefit, as that's one question I never
quite understood the subtleties of...

Thanks drieux,

__
Jean-Sébastien Guay
Conseiller
 Service des cartes de débit et guichets
 Services électroniques - Direction 499
 Banque Laurentienne du Canada
 Tél: 514.522.9800 poste 4840
 Utilisez nos services BLCDirect :  http://www.banquelaurentienne.com 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE:Apel of VIM was Emacs Wizards

2004-01-14 Thread Jeff Westman
Paul Kraus [EMAIL PROTECTED] wrote:

  (I love emacs, but vi is my tool of choice day-to-day ... much
  quicker  vim is even better if you have it)
  Why? I started with emacs just because it happened to be the 1st
 I heard
 about. Since you know both why does vim appeal to you over emacs?
 Other then
 size.

I started off with the emacs version originally put out by MIT in
the 80s.  Loved it.  Then came along gnuemacs, gemacs, xemacs, etc.
 All great improvements.  

Simply stated, running 'vi' from the command line (ie, start-up) is
faster than *emacs.  BUT, a TRUE emacs-person would rarely exit
from it and run everything within it's extensive environment.

To be honest?  I can't remember half of the commands in emacs.  But
as stated, it is simply faster for most day-to-day tasts.

JW 


__
Do you Yahoo!?
Yahoo! Hotjobs: Enter the Signing Bonus Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Apel of VIM was Emacs Wizards

2004-01-14 Thread drieux
On Jan 14, 2004, at 10:49 AM, Paul Kraus wrote:
[..]
 Why? I started with emacs just because it happened
to be the 1st I heard about. Since you know both why
does vim appeal to you over emacs? Other then size.
Not wishing to start an editor war, allow me to wander.

A part of the issue we are wandering into is the problem
of can one code without an IDE... and in particular without
a GUI that provides colour coded syntax matching...
One way to think about the problem is:
http://www.wetware.com/drieux/PR/blog2/Code/200401.html#id3156855452
One of the reasons that folks tend to use vi,
and hence vim, is that it is small, it is one of
those tools that is now ubiquitous, and at ohDarkSquat
on a telnet session to the far side of the moon you
can quickly hack a patch... It beats the snot out
of trying to either do it all in ed, which we did,
or trying to make that one liner perl -pie ''
work right the first time...
So it is a logicalish progression to go from vi to vim,
with or without the Xwindow GUI widget set.
Does that mean that we are willing to give up our
preferred IDE's with cool colour coded syntax matching
Yeah, Right. When you Rip It From My Cold DEAD Hands...

ciao
drieux
---

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: == eq gt

2004-01-14 Thread Randal L. Schwartz
 Paul == Paul Kraus [EMAIL PROTECTED] writes:

Paul I understand that the eq and gt are for string comparisons but why not just
Paul use the mathematical ones of == or . This goes for functions open ... or
Paul compared to open .. ||

Because 3 == 3.0 but 3 ne 3.0
and 3  12 but 3 gt 12.

You'll get differnet results.  Perl needs a hint about which
kind of comparison you want.

print Just another Perl hacker,

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Dumping values of all vars

2004-01-14 Thread jdavis
Hello,
 Is it possible to dump the values of all the vars in a perl script
easily? I want to have a sub called Error that when called 
will tell me the current value of all the vars in the script.

thanks,
-- 
jdavis [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Question about CPAN

2004-01-14 Thread Hemond, Steve
Hi ppl!

I just used CPAN for the first time and everything is FINE. :-)

After the initial configuration setup is done, it suggest me to install
Bundle::CPAN.

First of all, what is that module?

Second of, I have noticed that it installed Readline, so my CPAN shell
looks like the bash shells (they obviously both use readline). That
leads me to another question (Aix users listen!) : Why in subshells
running ftp, telnet, cpan (initially), the backspace does ^H ? I run ksh
as my default shell but I always got this problem when running these
programs. Just before I have installed readline for CPAN, my CPAN shell
was writing ^H's when backspacing.

Could anyone guide me to a document talking about .pm's? I didn't think
they were compiled (make)?

Thanks in advance,

Best regards,

Steve Hemond
Programmeur Analyste / Analyst Programmer
Smurfit-Stone, Ressources Forestieres
La Tuque, P.Q.
Tel.: (819) 676-8100 X2833
[EMAIL PROTECTED] 


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Question about CPAN

2004-01-14 Thread Tassilo von Parseval
On Wed, Jan 14, 2004 at 03:05:20PM -0500 Hemond, Steve wrote:

 I just used CPAN for the first time and everything is FINE. :-)
 
 After the initial configuration setup is done, it suggest me to install
 Bundle::CPAN.
 
 First of all, what is that module?

It is the very module you were using in this moment (bundled with its
prerequisites, hence it's a 'bundle'). I'd always keep it up-to-date so
it's a good idea to do a 'install Bundle::CPAN'.

 Second of, I have noticed that it installed Readline, so my CPAN shell
 looks like the bash shells (they obviously both use readline). That
 leads me to another question (Aix users listen!) : Why in subshells
 running ftp, telnet, cpan (initially), the backspace does ^H ? I run ksh
 as my default shell but I always got this problem when running these
 programs. Just before I have installed readline for CPAN, my CPAN shell
 was writing ^H's when backspacing.

I don't know. It's certainly not related to Perl in any way.

 Could anyone guide me to a document talking about .pm's? I didn't think
 they were compiled (make)?

Can you be more specific? Those files are Perl modules and thus they are
written in Perl (they are usually the meat of any stuff you download
from the CPAN). That means that these never need to be compiled. Around
95% of the CPAN will not require any compilation. Perl modules written
in (or containing) C need a C-compiler.

As for 'make', this is not doing the compilation, if any. 'make'
processes a Makefile that contains certain rules. It is most often used
for building and installing a piece of software. Most of the modules on
the CPAN contain a file 'Makefile.PL' that - when run - produces a file
called 'Makefile'. After you have that, you can continue with

make
make test
make install

The first line will do any necessary preparations (this could also be
compiling C code when the module contains bits of it). The second line
triggers the rule 'test' which will run any tests enclosed in the
package. The last one finally installs the module.

When you use the cpan shell, all the above happens behind the scenes.
More precisely, in this order:

perl Makefile.PL
make
make test
make install

Tassilo
-- 
$_=q#,}])!JAPH!qq(tsuJ[{@tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?=sub).+q#q!'qq.\t$.'!#+sexisexiixesixeseg;y~\n~~;eval


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Apel of VIM was Emacs Wizards

2004-01-14 Thread Tim
At 11:24 AM 1/14/04 -0800, you wrote:
...
or trying to make that one liner perl -pie ''
work right the first time...


Isn't that what the i is for (with .bak, of course)?  ;-)



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



RE: Apel of VIM was Emacs Wizards

2004-01-14 Thread Bradley A. Brown
I use vim on a daily basis from the command line and its syntax highlighting
and color coding is very nice in my opinion.
I'm not flaming here so don't take me wrong, but I heard it said once that
knowledge of a language can never be replaced by an IDE. IDE's have always
been a put off to me, but I can see their usefullness in many projects.
Bradley

-Original Message-
From: Tim [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 14, 2004 3:47 PM
To: drieux
Cc: [EMAIL PROTECTED]
Subject: Re: Apel of VIM was Emacs Wizards


At 11:24 AM 1/14/04 -0800, you wrote:
...
or trying to make that one liner perl -pie ''
work right the first time...


Isn't that what the i is for (with .bak, of course)?  ;-)



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE : Apel of VIM was Emacs Wizards

2004-01-14 Thread Hemond, Steve
So true.

Steve Hemond
Programmeur Analyste / Analyst Programmer
Smurfit-Stone, Ressources Forestières
La Tuque, P.Q.
Tel.: (819) 676-8100 X2833
[EMAIL PROTECTED] 



  -Original Message-
  From: Bradley A. Brown [mailto:[EMAIL PROTECTED] 
  Sent: Wednesday, January 14, 2004 3:57 PM
  To: [EMAIL PROTECTED]
  Subject: RE: Apel of VIM was Emacs Wizards
  
  
  I use vim on a daily basis from the command line and its 
  syntax highlighting and color coding is very nice in my 
  opinion. I'm not flaming here so don't take me wrong, but I 
  heard it said once that knowledge of a language can never be 
  replaced by an IDE. IDE's have always been a put off to me, 
  but I can see their usefullness in many projects. Bradley
  
  -Original Message-
  From: Tim [mailto:[EMAIL PROTECTED] 
  Sent: Wednesday, January 14, 2004 3:47 PM
  To: drieux
  Cc: [EMAIL PROTECTED]
  Subject: Re: Apel of VIM was Emacs Wizards
  
  
  At 11:24 AM 1/14/04 -0800, you wrote:
  ...
  or trying to make that one liner perl -pie ''
  work right the first time...
  
  
  Isn't that what the i is for (with .bak, of course)?  ;-)
  
  
  
  -- 
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED] 
http://learn.perl.org/ http://learn.perl.org/first-response



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ 
http://learn.perl.org/first-response


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Question about CPAN

2004-01-14 Thread Wiggins d Anconia
 On Wed, Jan 14, 2004 at 03:05:20PM -0500 Hemond, Steve wrote:
 
  I just used CPAN for the first time and everything is FINE. :-)
  
  After the initial configuration setup is done, it suggest me to install
  Bundle::CPAN.
  
  First of all, what is that module?
 
 It is the very module you were using in this moment (bundled with its
 prerequisites, hence it's a 'bundle'). I'd always keep it up-to-date so
 it's a good idea to do a 'install Bundle::CPAN'.

Actually plain 'CPAN' is the module you are using, and the Bundle::CPAN
at least in some versions can be very annoying in that if you do not
have an up-to-date Perl installed it will try to help you and upgrade
your Perl which can be *very* annoying. Rumor has it that this is fixed
in newer versions of Perl/CPAN...??  It is a good idea to keep CPAN
up-to-date, but Bundle::CPAN is another story (or used to be)

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




error.

2004-01-14 Thread Eric Walker
Does anyone know what this means...
code..
for ($i = 0;$i = $size; $i+=$temp){
 $type= split(::,shift (@hold));
 }

Warning:
Use of implicit split to @_ is deprecated at .//test.pl line 21

help, thanks

perlknucklehead





Re: error.

2004-01-14 Thread Jeff Westman
Eric Walker [EMAIL PROTECTED] wrote:

 Does anyone know what this means...
 code..
 for ($i = 0;$i = $size; $i+=$temp){
  $type= split(::,shift (@hold));
  }
 
 Warning:
 Use of implicit split to @_ is deprecated at .//test.pl line 21

Because perl is expecting an array (@_) to be returned and you are
putting it into a scalar.

That's my guess

JW

__
Do you Yahoo!?
Yahoo! Hotjobs: Enter the Signing Bonus Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: error.

2004-01-14 Thread Tim Johnson

As far as I can see...

The split() function returns a list, not a scalar.  When you tried to assign it to a 
scalar, it tried to assign the result to @_ and then assign the number of items in @_ 
to $type.  Maybe I'm wrong, someone else will probably correct me i so.  In any case, 
I'm almost 100% sure that isn't what you want.

-Original Message-
From: Eric Walker [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 14, 2004 3:03 PM
To: perlgroup
Subject: error.


Does anyone know what this means...
code..
for ($i = 0;$i = $size; $i+=$temp){
 $type= split(::,shift (@hold));
 }

Warning:
Use of implicit split to @_ is deprecated at .//test.pl line 21

help, thanks

perlknucklehead




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: error.

2004-01-14 Thread Eric Walker
On Wed, 2004-01-14 at 16:17, Tim Johnson wrote:

As far as I can see...

The split() function returns a list, not a scalar.  When you tried to assign it to 
a scalar, it tried to assign the result to @_ and then assign the number of items in 
@_ to $type.  Maybe I'm wrong, someone else will probably correct me i so.  In any 
case, I'm almost 100% sure that isn't what you want.

-Original Message-
From: Eric Walker [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 14, 2004 3:03 PM
To: perlgroup
Subject: error.


Does anyone know what this means...
code..
for ($i = 0;$i = $size; $i+=$temp){
 $type= split(::,shift (@hold));
 }

Warning:
Use of implicit split to @_ is deprecated at .//test.pl line 21

help, thanks

perlknucklehead

ok thanks... 




RE: error.

2004-01-14 Thread Eric Walker
On Wed, 2004-01-14 at 16:17, Tim Johnson wrote:

As far as I can see...

The split() function returns a list, not a scalar.  When you tried to assign it to 
a scalar, it tried to assign the result to @_ and then assign the number of items in 
@_ to $type.  Maybe I'm wrong, someone else will probably correct me i so.  In any 
case, I'm almost 100% sure that isn't what you want.

-Original Message-
From: Eric Walker [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 14, 2004 3:03 PM
To: perlgroup
Subject: error.


Does anyone know what this means...
code..
for ($i = 0;$i = $size; $i+=$temp){
 $type= split(::,shift (@hold));
 }

Warning:
Use of implicit split to @_ is deprecated at .//test.pl line 21

help, thanks

perlknucklehead






RE: Apel of VIM was Emacs Wizards

2004-01-14 Thread Jeff Westman
Incidently, emacs has a 'dired mode' (directory editor) which is
very nice... much like the old 'list' shareware in DOS land of the
dark past you can bring up a list of files (like 'ls -l'), then
view and selectively execute or delete all that you mark.  It's
very nice, and it can also be used when accessing remote servers. 
Not to mention it allows syntax highlighting.

As driex pointed out, it is the start-up time that is preferred in
vi/vim.  But again, a true emacs die-hard never exits the editor
and does all his/her tasks inside the of it.  

Not to mention, the learning curve for emacs is horrific.

JW

~

Bradley A. Brown [EMAIL PROTECTED] wrote:

 I use vim on a daily basis from the command line and its syntax
 highlighting
 and color coding is very nice in my opinion.
 I'm not flaming here so don't take me wrong, but I heard it said
 once that
 knowledge of a language can never be replaced by an IDE. IDE's
 have always
 been a put off to me, but I can see their usefullness in many
 projects.
 Bradley
 
 -Original Message-
 From: Tim [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, January 14, 2004 3:47 PM
 To: drieux
 Cc: [EMAIL PROTECTED]
 Subject: Re: Apel of VIM was Emacs Wizards
 
 
 At 11:24 AM 1/14/04 -0800, you wrote:
 ...
 or trying to make that one liner perl -pie ''
 work right the first time...
 
 
 Isn't that what the i is for (with .bak, of course)?  ;-)
 
 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 http://learn.perl.org/ http://learn.perl.org/first-response
 
 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 http://learn.perl.org/ http://learn.perl.org/first-response
 
 


__
Do you Yahoo!?
Yahoo! Hotjobs: Enter the Signing Bonus Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




strange sort order

2004-01-14 Thread danl001
Hello,

I do not have access to the sort operation. All I have is a file that is 
sorted but I don't know exactly the mechanism by which it was sorted. 
What I am trying to do is write a comparison function--given any two 
lines in this file, return -1, 0, 1 as perl's cmp function does. I don't 
have to sort the whole file, I just need to be able to tell, given two 
lines, which should come before the other in the sorted ordering. (I 
need this to do a binary search over the file, which is quite large).

Anyhow, I'm posting the function I wrote to do this. It is quite long 
and to me is naive. It is also pretty slow. I have tested function in a 
larger script that I wrote. As a method of comparison, the script takes 
23 sec to run over a 500k file using my function. When I substituted 
perl's cmp for my function, the same script ran in 12 sec. I'd really 
like to get this running more quickly as I have to run my script on 
files MUCH larger than 500k.

I'm thinking the way the file is sorted is something simple, yet 
something I don't recgonize! As a result, you'll see that my method is 
probably very over-complicated.

I have also posted some more data that is representative of what I have 
to work with. Both the comparison function I'm using and the sample data 
are attached if anyone wants to check it out. I appreicate any suggestions.

Dan

Rob Dixon wrote:
Dan Laflamme wrote:

I have a file that appears to be somewhat sorted, but is not sorted
according to the traditional unix sort. I'll give some examples, and if
anyone recgonizes the way in which the file is sorted, please let me
know. Also, since I may have to write a comparator function for use on
this sorted file, any tips on doing that in the most efficient way
possible would be helpful. Thanks.
Examples. I give some sets of strings to indicate which comes before the
other in the sorted file. The first one in each pair is less than the
second. Each set is independent of the others. set x doesnt necessarily
come before set y in the file if x  y.
Set 1:
0-CELEBRITY-0
0-CELEBRITY
Set 2:
0-0-7
0-0
Set 3:
000-AAA
000
Set 4:
000

Set 5:
0908
09088122595
09088122595
0909-114


We could make guesses as to the sort algorithm, but there is very little data
here to go on. If you sort stringwise on the first fragment of the string up to
the dash then you will get exactly this order. But several strings have the same
first fragment (all of Set 1 and Set 2, for instance, start with the value '0').
Do you have access to the sort operation so that you can sort arbitrary data?
This can be decided properly only by seeing how contrived test data is sorted.
Rob




0-02-13.LCDAFAH-JDC.LAME-DELEGATION
0-13-02.LCDAFAH-JDC.LAME-DELEGATION
0.0-1
0.BLACKCAT.NS.CHIARK
0.NS.ORBIS
0.NS.USMAC
0.TACOMAWIRELESS
000.SERVIDORES
.SERVIDORES
000SGWBIN-01.SMARTGW
01010101.MENTALFLOSS
01NS01.AIR-SPEED
01NS02.AIR-SPEED
02ROBOX01.I
0803MLSS.SHIENHI
0X6E7331.0XEB
0X6E7332.0XEB
1.0-1
1.07
1.1C
1.AD4HOST
1.BLACKCAT.NS.CHIARK
1.NDB.9SRV
1.NS.NARKIEWICZ
1.NS.ORBIS
1.NS.USMAC
1.QUDSWAY
101Q-MA.MAILSCAN
105.MGOG
105.WEBWORLDS
10801NET.10801
10DEEP.PAPERKILL
10TH-PLANET.CELTIC-HOSTING
11016A.COBALTHOSTING
111.ICOMIS
12-USCOFC-DC-01.INWIRED
900DOM002.EMNW
91C
98TM
99.800GIFT
9KS.OHBO
A-93.AKADNS
A-NS.PRIMARI
A-NS.SCHALIT-WAY
A-NS.SECQR
A-S1.ANTWINES
A-S2.ANTWINES
A.BEK.JP.NS.TOKYOTOPLESS
A.BENCHTOPLABS
A.BEST-VIEW-ROOT-SERVERS
A.BINSOORE
A.BITLESS
A.BODOSOM
A.DATESEX
A.DNS-RDMEDIAS
A.DNS.HOSTWAY
A.DNS.TDS
A.E2E-TEST
A.EGPG.GEO.HOST.ZENSOFT
A.FREEMINDDESIGNS
AAI-NS1.INTRNET
AAI-NS2.INTRNET
AANDA01.AANDAELECTRIC
AANDA02.AANDAELECTRIC
AANDKCATERING4-BIZOPIA.NS1.AANDKCATERING
AANDKCATERING4-BIZOPIA.NS2.AANDKCATERING
AANS1.AAHOSTING
AARDVARK.ZOO
AARON.MATHFORGE
AARONCAKE
AAYT.NIS
AB.WIREMOUTH
ABA.ALKALAY
ABACI.RUTIL
ABACO.KENNETT
ABAGAIL.BCINET
ABBADON.COMSATVEN
ABBOTT.UPLINC
ABBY-W2K1.ABBYSENIOR
ABBY.WIREDBIZ
ABC-MARKET.ABC-MARKET
ABC-MARKET

sub compare {
my $a = shift;
my $b = shift;

##print a: $a\n;
##print b: $b\n;

# get the indices of any delimiters
my $adash = index($a, '-');
my $bdash = index($b, '-');
my $adot = index($a, '.');
my $bdot = index($b, '.');

##print adash: $adash adot: $adot\n;
##print bdash: $bdash bdot: $bdot\n;

my ($aDelim, $bDelim, $aDelimType, $bDelimType);

if ($adash == -1  $adot == -1) {
# no delimiter in either string
$aDelim = -1; $aDelimType = 4;
} elsif ($adash == -1) {
# a's first delimiter is a dot
$aDelim = $adot; $aDelimType = 3;
} elsif ($adot == -1) {
# a's first delimiter is a dash
$aDelim = $adash; $aDelimType = 2;
} else {
# smaller of the two
if ($adash  $adot) {
$aDelim = $adash;
$aDelimType = 2;
} else {
$aDelim = $adot;
$aDelimType = 3;
}
}


if ($bdash == -1  $bdot == -1) {
# no delimiter in either string
$bDelim = -1; 

Re: strange sort order

2004-01-14 Thread Daniel Staal
--As off Wednesday, January 14, 2004 6:23 PM -0500, danl001 is 
alleged to have said:

I'm thinking the way the file is sorted is something simple, yet
something I don't recgonize! As a result, you'll see that my method
is probably very over-complicated.
I have also posted some more data that is representative of what I
have to work with. Both the comparison function I'm using and the
sample data are attached if anyone wants to check it out. I
appreicate any suggestions.
--As for the rest, it is mine.

Quick question: is this data more representative than the data in the 
first email?  In particular, does set 4 from the first email actually 
exist, exactly as listed, anywhere?

If this latter data is more representative I'd bet on ASCIIbetical 
ordering: Compare each string one character at a time based on it's 
ASCII encoding, and stop the comparison at the first different 
character.  Don't think of numbers or punctuation as anything 
different, just handle them the same.

Daniel T. Staal

---
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: error.

2004-01-14 Thread Rob Dixon
Eric Walker wrote:

 Does anyone know what this means...
 code..
 for ($i = 0;$i = $size; $i+=$temp){
  $type= split(::,shift (@hold));
  }

 Warning:
 Use of implicit split to @_ is deprecated at .//test.pl line 21

perldoc -f split says:

  split   Splits a string into a list of strings and returns that list. By
  default, empty leading fields are preserved, and empty trailing
  ones are deleted.

  In scalar context, returns the number of fields found and splits
  into the @_ array. Use of split in scalar context is
  deprecated, however, because it clobbers your subroutine
  arguments.

But if you insist on using it, add

  no warnings 'deprecated';

and Perl won't moan at you.

Rob



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: strange sort order

2004-01-14 Thread danl001
Daniel Staal wrote:
Quick question: is this data more representative than the data in the 
first email?  In particular, does set 4 from the first email actually 
exist, exactly as listed, anywhere?

If this latter data is more representative I'd bet on ASCIIbetical 
ordering: Compare each string one character at a time based on it's 
ASCII encoding, and stop the comparison at the first different 
character.  Don't think of numbers or punctuation as anything different, 
just handle them the same.

Daniel T. Staal
The data from the first email actually exists in the file. Set 4 was:

000

and yes, that appears in the file in that order. Also, the sample data I 
gave in the last email exists as listed as well.

So in set 4, we'd scan the first 3 corresponding characters but the 
first would run out. If we treated it as a null, which has ASCII value = 
0, then 000 would come before  and we have the right ordering.

However, the last two lines int he sample file i gave are:

ABC-MARKET.ABC-MARKET
ABC-MARKET
Here, the first 10 characters correspond but then the second string runs 
out. Using our rule, we'd order ABC-MARKET before ABC-MARKET.ABC-MARKET, 
which is wrong. I guess I could try following that rule, but if the 
character position in the longer string that corresponds to the first 
position in the shorter string where there is no character is a - or a 
., then the longer string is less. Just a thought. I'll have to 
check out the data more and try it out.

Thanks,

Dan

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



multiline matching

2004-01-14 Thread Jose Malacara
Can someone explain to me how to do multiline matching? I am trying to extract three 
consecutive lines from a datafile containing multiple records like this:

Name: Bob
City: Austin
State: Texas
Address: 123 Whatever
Age: 46 

Name: Jose
City: Denver
State: Colorado
Address: 118 Mystreet
Age: 28 



This is what I have so far, but it doesn't seem to work:

#!/usr/bin/perl -w
open FILE, file1 or die Can't open file!\n;
while (FILE){
  if ( /^Name: (.*)\nCity: (.*)\nState: (.*)/) {
   print Match found!\n;  # ideally, I want to print the the lines found
  }
}
close FILE;

But for some reason, it doesn't seem to like the (\n)'s in the regex. Any help would 
be appreciated!

This is what I would like to return:

Name: Bob
City: Austin
State: Texas

Name: Jose
City: Denver
State: Colorado


Thanks in advance,
Jose

Re: multiline matching

2004-01-14 Thread Jeff Westman
Jose Malacara [EMAIL PROTECTED] wrote:

 Can someone explain to me how to do multiline matching? I am
 trying to extract three consecutive lines from a datafile
 containing multiple records like this:

Check out 

perldoc perlre

What you should do is look at the 'm' (multiple line) option.


HTH

JW

 
 Name: Bob
 City: Austin
 State: Texas
 Address: 123 Whatever
 Age: 46 
 
 Name: Jose
 City: Denver
 State: Colorado
 Address: 118 Mystreet
 Age: 28 
 
 
 
 This is what I have so far, but it doesn't seem to work:
 
 #!/usr/bin/perl -w
 open FILE, file1 or die Can't open file!\n;
 while (FILE){
   if ( /^Name: (.*)\nCity: (.*)\nState: (.*)/) {
print Match found!\n;  # ideally, I want to print the the
 lines found
   }
 }
 close FILE;
 
 But for some reason, it doesn't seem to like the (\n)'s in the
 regex. Any help would be appreciated!
 
 This is what I would like to return:
 
 Name: Bob
 City: Austin
 State: Texas
 
 Name: Jose
 City: Denver
 State: Colorado
 
 
 Thanks in advance,
 Jose


__
Do you Yahoo!?
Yahoo! Hotjobs: Enter the Signing Bonus Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: multiline matching

2004-01-14 Thread Kenton Brede
On Wed, Jan 14, 2004 at 06:22:58PM -0700, Jose Malacara wrote:
 Can someone explain to me how to do multiline matching? I am trying to extract three 
 consecutive lines from a datafile containing multiple records like this:
 
 Name: Bob
 City: Austin
 State: Texas
 Address: 123 Whatever
 Age: 46 
 
 Name: Jose
 City: Denver
 State: Colorado
 Address: 118 Mystreet
 Age: 28 
 
 
 
 This is what I have so far, but it doesn't seem to work:
 
 #!/usr/bin/perl -w
 open FILE, file1 or die Can't open file!\n;
 while (FILE){
   if ( /^Name: (.*)\nCity: (.*)\nState: (.*)/) {
print Match found!\n;  # ideally, I want to print the the lines found
   }
 }
 close FILE;
 
 But for some reason, it doesn't seem to like the (\n)'s in the regex. Any help would 
 be appreciated!
 
 This is what I would like to return:
 
 Name: Bob
 City: Austin
 State: Texas
 
 Name: Jose
 City: Denver
 State: Colorado

I'm sure others will have better solutions but this works -

#!/usr/bin/perl
use warnings;
use strict;

while (DATA) {
print if /^Name:/;
print if /^City:/;
print $_\n if /^State:/;
}

__DATA__
Name: Bob
City: Austin
State: Texas
Address: 123 Whatever
Age: 46

Name: Jose
City: Denver
State: Colorado
Address: 118 Mystreet
Age: 28

hth,
Kent

-- 
I am always doing that which I can not do, 
   in order that I may learn how to do it. --Pablo Picasso


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: multiline matching

2004-01-14 Thread Jose Malacara
Thanks, Jeff. I read over the reference, but I guess I am missing the
syntax as I cannot get it to work properly. Can you point me to any
examples?

I found this example, but am having trouble translating it to my while
loop:

 perl -e '$_ = {a\n{bb}\n{c\n\nc}\na\}; m({.*})m; print $'


Thanks again,
Jose

On Wed, 2004-01-14 at 18:37, Jeff Westman wrote:
 Jose Malacara [EMAIL PROTECTED] wrote:
 
  Can someone explain to me how to do multiline matching? I am
  trying to extract three consecutive lines from a datafile
  containing multiple records like this:
 
 Check out 
 
 perldoc perlre
 
 What you should do is look at the 'm' (multiple line) option.
 
 
 HTH
 
 JW
 
  
  Name: Bob
  City: Austin
  State: Texas
  Address: 123 Whatever
  Age: 46 
  
  Name: Jose
  City: Denver
  State: Colorado
  Address: 118 Mystreet
  Age: 28 
  
  
  
  This is what I have so far, but it doesn't seem to work:
  
  #!/usr/bin/perl -w
  open FILE, file1 or die Can't open file!\n;
  while (FILE){
if ( /^Name: (.*)\nCity: (.*)\nState: (.*)/) {
 print Match found!\n;  # ideally, I want to print the the
  lines found
}
  }
  close FILE;
  
  But for some reason, it doesn't seem to like the (\n)'s in the
  regex. Any help would be appreciated!
  
  This is what I would like to return:
  
  Name: Bob
  City: Austin
  State: Texas
  
  Name: Jose
  City: Denver
  State: Colorado
  
  
  Thanks in advance,
  Jose
 
 
 __
 Do you Yahoo!?
 Yahoo! Hotjobs: Enter the Signing Bonus Sweepstakes
 http://hotjobs.sweepstakes.yahoo.com/signingbonus
-- 
Jose Malacara
[EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Dumping values of all vars

2004-01-14 Thread Mark Stosberg
On 2004-01-14, jdavis [EMAIL PROTECTED] wrote:
 Hello,
  Is it possible to dump the values of all the vars in a perl script
 easily? I want to have a sub called Error that when called 
 will tell me the current value of all the vars in the script.

Have you read about the perl debugger? I recommend perldoc perldebtut.
It has a function to dump all the values in the current name space.
That doesn't directly answer your question, but it may help with your
issue.

Mark

-- 
http://mark.stosberg.com/ 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: multiline matching

2004-01-14 Thread Daniel Staal
--As off Wednesday, January 14, 2004 6:22 PM -0700, Jose Malacara is 
alleged to have said:

Can someone explain to me how to do multiline matching? I am trying
to extract three consecutive lines from a datafile containing
multiple records like this:
Name: Jose
City: Denver
State: Colorado
Address: 118 Mystreet
Age: 28


This is what I have so far, but it doesn't seem to work:

# !/usr/bin/perl -w
open FILE, file1 or die Can't open file!\n;
while (FILE){
  if ( /^Name: (.*)\nCity: (.*)\nState: (.*)/) {
   print Match found!\n;  # ideally, I want to print the the
lines found   }
}
close FILE;
But for some reason, it doesn't seem to like the (\n)'s in the
regex. Any help would be appreciated!
--As for the rest, it is mine.

You actually have two seperate problems here...  First off, you 
aren't reading more than one line at a time, since the readline 
operator stops at a newline.  Then, a regrex normally stops at a 
newline too, unless you specifically tell it to continue past those. 
( The 'm' operator, mentioned in other posts.)

The first problem is actually the bigger one: The obvious solution of 
reading the whole file to an array/scalar first has preformance 
problems, especially with large files.  (Worst case: A file bigger 
than avalible memory...)

Kent's solution neatly sidesteps that, if you don't care that the 
program has no idea of which records go together.  (His solution just 
prints each record line, assuming they are in the correct order 
already.)  Otherwise you are going to need some sort of temporary 
storage where you put the records back together, or read the file in 
chunks.

Daniel T. Staal

---
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: strange sort order

2004-01-14 Thread Dan
danl001 wrote:

Here, the first 10 characters correspond but then the second string runs 
out. Using our rule, we'd order ABC-MARKET before ABC-MARKET.ABC-MARKET, 
which is wrong. I guess I could try following that rule, but if the 
character position in the longer string that corresponds to the first 
position in the shorter string where there is no character is a - or a 
., then the longer string is less. Just a thought. I'll have to 
check out the data more and try it out.


Oh no! Its slower! I wrote a function implementing what is described 
above and its actually slower (about 1/2 as slow) than that huge thing I 
posted earlier. Does anything stand out here as being inefficient? Here 
it is:

sub compare {
my $a = shift;
my $b = shift;
my $asciiDASH = 45;
my $asciiDOT = 46;
my @a = unpack(C*, $a);
my @b = unpack(C*, $b);
foreach my $achar (@a) {
my $bchar = shift(@b);
if (defined($achar)) {
if (defined($bchar)) {
 # both defined
 if ($achar == $bchar) {
 #print $achar == $bchar\n;
 next;
 } elsif ($achar  $bchar) {
 #print $achar  $bchar\n;
 return 1;
 } else  {
 #print $achar  $bchar\n;
 return -1;
 }
} else {
# achar defined, bchar not
if ($achar == $asciiDASH) {
#print achar: $achar is dash\n;
return -1;
} else {
#print achar: $achar is NOT dash\n;
return 1;
}
}
} else {
# achar undefined
if (defined($bchar)) {
# bchar defined, achar not
if ($bchar == $asciiDASH) {
#print bchar: $bchar is dash\n;
return 1;
} else {
#print bchar: $bchar is NOT dash\n;
return -1;
}
} else {
# both undefined
return 0;
}
}
}
my $bchar = shift(@b);
if (!defined($bchar)) {
return 0;
} else {
if($bchar == $asciiDASH) {
   #print bchar: $bchar is dash\n;
   return 1;
} else {
   #print bchar: $bchar is NOT dash\n;
   return -1;
}
}
}



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: multiline matching

2004-01-14 Thread James Edward Gray II
On Jan 14, 2004, at 7:22 PM, Jose Malacara wrote:

Can someone explain to me how to do multiline matching? I am trying to 
extract three consecutive lines from a datafile containing multiple 
records like this:

Name: Bob
City: Austin
State: Texas
Address: 123 Whatever
Age: 46
Name: Jose
City: Denver
State: Colorado
Address: 118 Mystreet
Age: 28


This is what I have so far, but it doesn't seem to work:

#!/usr/bin/perl -w
open FILE, file1 or die Can't open file!\n;
while (FILE){
  if ( /^Name: (.*)\nCity: (.*)\nState: (.*)/) {
   print Match found!\n;  # ideally, I want to print the the lines 
found
  }
}
close FILE;

But for some reason, it doesn't seem to like the (\n)'s in the regex. 
Any help would be appreciated!

This is what I would like to return:

Name: Bob
City: Austin
State: Texas
Name: Jose
City: Denver
State: Colorado
Since you've already been shown the super easy way, I'll dare to be a 
little different:

#!/usr/bin/perl

use strict;
use warnings;
$/ = '';# enter paragraph mode
while () {  # call with: perl script_name file1
my %contact = map { /^(\w+):\s*(.+)$/ } split /\n/, $_;
print $_: $contact{$_}\n foreach qw(Name City State);
print \n
}
__END__

The first way your were shown is probably a little easier, but this 
method is probably better if you want to do anything more complicated 
than simple printing, since you have the whole hash to play with.  It's 
a different way of thinking about the problem at least.

Good luck.

James

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: strange sort order

2004-01-14 Thread Daniel Staal
--As off Wednesday, January 14, 2004 10:48 PM -0500, Dan is alleged 
to have said:

Oh no! Its slower! I wrote a function implementing what is
described above and its actually slower (about 1/2 as slow) than
that huge thing I posted earlier. Does anything stand out here as
being inefficient? Here it is:
(First glance stuff:)

sub compare {
 my $a = shift;
 my $b = shift;
If this is a 'real' sort operation this isn't necessary, and 
shouldn't even work.  Perl will do this for you.

 my $asciiDASH = 45;
 my $asciiDOT = 46;
These are legitimate constants.  Declare them as such, outside of the 
subroutine.  Then these assignments will only happen once, at compile 
time.  (Instead of _every_ time the sort calls this routine.)

 my @a = unpack(C*, $a);
 my @b = unpack(C*, $b);
This can also be done with a:
my @a = split //, $a;  # (That is a null pattern.)
I'm not sure if split or unpack is faster, I'll have to benchmark in 
the morning.

Daniel T. Staal

---
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: multiline matching

2004-01-14 Thread Kenton Brede
On Wed, Jan 14, 2004 at 09:57:51PM -0600, James Edward Gray II ([EMAIL PROTECTED]) 
wrote:
 On Jan 14, 2004, at 7:22 PM, Jose Malacara wrote:
snip 

 Since you've already been shown the super easy way, I'll dare to be a 
 little different:
 
 #!/usr/bin/perl
 
 use strict;
 use warnings;
 
 $/ = '';  # enter paragraph mode
 while () {  # call with: perl script_name file1
   my %contact = map { /^(\w+):\s*(.+)$/ } split /\n/, $_;
   print $_: $contact{$_}\n foreach qw(Name City State);
   print \n
 }
 
 __END__
 
 The first way your were shown is probably a little easier, but this 
 method is probably better if you want to do anything more complicated 
 than simple printing, since you have the whole hash to play with.  It's 
 a different way of thinking about the problem at least.

Thanks for posting this.  My first thought was a hash, thinking in terms
of key-item but I couldn't figure out how to populate the hash.  This
code will give me something to analyze.  The map function looks like
voodoo to me:)
Kent  

-- 
I am always doing that which I can not do, 
   in order that I may learn how to do it. --Pablo Picasso


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: multiline matching

2004-01-14 Thread Tim Johnson

Just for the sake of showing another solution (even though I'm not doing any 
multi-line matching), how about:

##

use strict;
use warnings;
open(INFILE,myfile.txt) || die Couldn't open myfile.txt for writing!\n;
while(INFILE){
   my %person;
   $person{name} = $_;
   $person{city} = INFILE;
   $person{state} = INFILE;
   $person{address} = INFILE;
   $person{age} = INFILE;
   #do whatever you want with your lines here
}

##

This gets you the whole record in a hash that goes out of scope after each record so 
that you don't have to slurp the file, but you have the flexibility to do whatever you 
want with the data.  You can replace the city and state lines with just INFILE; on 
its own line if you don't need the data for anything.  Of course I'm assuming the file 
is in order, but I figured that was implied by the three consecutive lines part of 
your question.



-Original Message-
From: Jose Malacara [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 14, 2004 5:23 PM
To: [EMAIL PROTECTED]
Subject: multiline matching


Can someone explain to me how to do multiline matching? I am trying to extract three 
consecutive lines from a datafile containing multiple records like this:

Name: Bob
City: Austin
State: Texas
Address: 123 Whatever
Age: 46 

Name: Jose
City: Denver
State: Colorado
Address: 118 Mystreet
Age: 28 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response