[21933] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4155 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 21 14:06:09 2002

Date: Thu, 21 Nov 2002 11:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 21 Nov 2002     Volume: 10 Number: 4155

Today's topics:
    Re: [Q] my vs. our nobull@mail.com
    Re: activestate perl sockets problem (rdack)
        An embedded perl app dies when perl does not compile (Igor11612)
        Automatic mail (send) with attachments using Perl (Joe Moore)
    Re: Basic syntax question on using arrays returned from <fxn@hashref.com>
    Re: Basic syntax question on using arrays returned from (Tad McClellan)
    Re: Can someone recommend a beginner's book on Perl? <cingram@pjocsNOSPAMORHAM.demon.co.uk>
        disambiguating print (was Re: Basic syntax question on  (Tad McClellan)
    Re: disambiguating print (was Re: Basic syntax question <Ed+nospam@ewildgoose.demon.co.uk@>
    Re: Format  a one line file to get two columns (ebchang)
        FREE Perl's memory??? Possible??? <n_joeller@sharaziilyar.com>
    Re: FREE Perl's memory??? Possible??? news@roaima.freeserve.co.uk
    Re: FREE Perl's memory??? Possible??? <mjcarman@mchsi.com>
        having problems parsing an error log. (JimL.)
    Re: help this Newbie in Distress <doris@chris.com>
    Re: help this Newbie in Distress (Helgi Briem)
    Re: How to print whatever text in Perl? <wksmith@optonline.net>
        I am Matthew D. Healy (was Re: Convert Perl script to C <joe+usenet@sunstarsys.com>
    Re: Improve my pivot program ctcgag@hotmail.com
    Re: passing address between classes - OO type question <uri@stemsystems.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 21 Nov 2002 10:47:14 -0800
From: nobull@mail.com
Subject: Re: [Q] my vs. our
Message-Id: <4dafc536.0211211047.5da49e9a@posting.google.com>

"Mothra" <mothra@nowhereatall.com> wrote in message news:<3ddaa995$1@usenet.ugs.com>...
> "Brian McCauley" <nobull@mail.com> wrote in message
> news:u9smxxtqco.fsf@wcl-l.bham.ac.uk...
> > ginak <gina02122000@yahoo.com> writes:
> >
> > > Suppose I have a CGI script (for example), and that I want to have a
> > > file-global variable $q that holds the CGI instance.  I could write
> > > either
> > >
> > >   our $q = CGI->new();
> > >
> > > or
> > >
> > >   my $q = CGI->new();
> > >
> > > Is there, in general, a compelling reason for choosing one over the
> > > other?
> >
> > Yes, if $q is used in any subroutines and you ever try to run the
> > script under mod_perl it will fail mysteriously if you use 'my'.  When
> > I say "mysteriously" I only mean until you find all the
> > will not remain shared warnings in the log.  Then it will cease to be
> > mysterious and just be annoying. :-)
> 
> I am faced with this situation now :-( and I was about to post but
> since it has come up. I will use this to ask my questions.
> >
> > I've seen some really hideously complex attempts at work-rounds for
> > this trivial problem published.  What's worse these bogus work-rounds
> > actually make the problem far worse if you have more than one CGI
> > script on your server.  Worse still they are published in places one
> > would usually condsider authoratative including the official mod_perl
> > porting guide.
> 
> When I checked the porting guide it provided 6 workarounds for this problem
> which of the 6 are incorrect? ( I do not want to use them).

OK I'll go have a look at 

http://perl.apache.org/docs/general/perl_reference/perl_reference.html#Remedies_for_Inner_Subroutines

The one that says:

 require "./mylib.pl";

Is exceptionally bad.  It will cause sporadic failures if you use it
in more than one script on your system and use the same name
"mylib.pl" in more than one script anywhere on the server.

The "use vars" solution is OK but on recent versions of Perl our() is
better than "use vars".  Also you'd have to remember to always reset
these variables to undef at the beginning of each script.  This is
more idiomatically done by simply saying local().  Also if anything
was relying on DESTROY being implicitly called at the end of the
script then changing my() to our() without local() will break this
unless you explicitly undef the variables at the end of the script.

Using an explicit $main:: prefix also a aesthetically abhorent
solution  solution because in a CGI script running under mod_perl as
the main:: namespace doesn't belong to you. In principle if two or
more script on the same server use the same variable name then they
can interfere.

Copying variables arroud is just messy - I can't think why this is
mentioned since even the guide goes on to say how bad it is.

Re-writing your script to pass references arround so that there are no
global variables is the purist (and indeed purest) solution.  But it's
hard work.

> > I'd recommend that all variables that are defined at the file scope in
> > CGI scripts should be introduced with "local our" rather than "my".
> 
> what about use vars?

'use vars' should be used as an alternative to our() if there is a
requirement for scripts to run on versions of Perl that predate the
introduction of our().

> I feel a little hesitant about using global varables.

This is good.  I feel hesitant about using chainsaws.  This doesn't
mean that there are no jobs for which they are the most appropriate
tool.
 
> from http://perl.plover.com/FAQs/Namespaces.html

That document is slightly out-of-date because it pre-dates our().

This does not effect the validity of anything it says.

> When to Use my and When to Use local
> Always use my; never use local.
> 
> Wasn't that easy

MJD is being over-simplitic.

As he correctly says: "You should avoid using global variables because
it can be hard to be sure that no two parts of the program are using
one another's variables by mistake."

If you write your scripts such that there are no global variables (the
purest/putrist solution above) then all is well and good and you never
need use anything but lexical variables.

Note that when I say global variables here I including _any_ variables
that used within a named subroutine and not declared _within_ that
subroutine using my().

If you do have any such variables - which are in effect global
variables anyhow, then, if you are writing a CGI script that may ever
be used under mod_perl then you should make them package variables. 
Since they are _already_ global variables admonishments about avoiding
global variables do not influence the choice to use package variables
rather than lexically scoped.

Note to detect shared variables:

( echo -n 'sub XXXX {'; cat myscript.pl; echo '}' ) | perl -wc


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

Date: 21 Nov 2002 08:45:01 -0800
From: rdacker@pacbell.net (rdack)
Subject: Re: activestate perl sockets problem
Message-Id: <644f6688.0211210845.23ca5556@posting.google.com>

Benjamin Goldberg <goldbb2@earthlink.net> wrote in message news:<3DDB222D.D09EA5CC@earthlink.net>...
> rdack wrote:
> > 
> > run one perl script as a socket server, but when i run another script
> > as client in a second dos window, i get an 'unknown error' trying to
> > connect:
> > 
> > use IO:Socket;
> > $port = 2233;
> > my $h = IO:Socket::INET->new(Proto => "tcp",
> >   LocalPort => "$port") or die "can't connect $!";
> > 
> > something wrong there?
> 
> I just noticed your problem... if you want to run as a tcp server, you
> need to have Listen => $maxcon in that list.
as noted in msg 3 of this thread, i got it working. the connect line
above was for the client, not the server. i had a 'Listen' param in
the server code. for now, my set up is adhoc -- what works. don't
exactly understand why one uses 'Peer..' or 'Local...' in the client
and the server code. i guess client uses 'Peer...' to reach over net
to find server, and server uses 'Local...' because that's where the
socket is. hmmm. well, i guess it does make sense.


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

Date: 21 Nov 2002 14:47:00 GMT
From: ignoramus11612@NOSPAM.11612.invalid (Igor11612)
Subject: An embedded perl app dies when perl does not compile
Message-Id: <slrnatpsf4.g1r.ignoramus11612@nospam.invalid>

I have an app that uses embedded perl. That is, it can invoke perl
scripts from C++ and the perl scripts have XS interface into C++.
This is our scripting mechanism.  It basically works OK unless there is
an error in perl modules that my app uses.

That is if I do (from C++) 

MyPerlInterface.executeScript( "use MyModule; MyModule::someFunction();" );

In such a case, if MyModule is not compilable, the app just dies
suddenly. What I would like is for it to get some kind of an exception
that it can handle gracefully.

I tried wrapping the above perl statement into an Eval block but it did
not help.

Any ideas?

Thanks

igor


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

Date: 21 Nov 2002 07:40:16 -0800
From: joemoore@att.com (Joe Moore)
Subject: Automatic mail (send) with attachments using Perl
Message-Id: <3aa86b4.0211210740.233fedb@posting.google.com>

I need to create reports and send them on a regular basis.  I don't
like to do boring things, so I have been working on automating the
process.  I tried to use Outlook to send my mail, but I received a
warning that Outlook thinks I might be a virus, and it requires me to
click.

I received a lot of help reviewing articles posted here, but nothing
that really gave a complete example on-point, so here is my
contribution.  I use MIME::Entity to create the message and
attachments.  I use Net::SMTP to send it using my smtp server.  Using
these modules, I am also able to Authenticate with the SMTP auth
method.

-- Joe Moore

Anyway this works for me on Windows 2000, ActiveState Perl.
To get the modules, from a command window, type ppm:
ppm> install MIME::Entity
ppm> install Net::SMTP

Here is the code I use:

#
# Now send the email
#
use MIME::Entity;
use Net::SMTP;

# create the multipart message with attachments
$msg = MIME::Entity->build(Type => 'multipart/mixed',
  From => 'bogus@mail.com',
  # The "To" here is displayed in the message header as "To"
  # This is not the actual list of recipients
  To => '"Display Name" <user1@mail.com>, "Second Person"
<user2@mail.com>',
  Subject => 'Automatic email of Excel report',
);
$msg->attach(
  Type => 'application/msexcel',
  Path => $report,
  Filename => 'college_orders.xls',
  Encoding => 'base64'
);
$msg->attach(Data => "Enclosed is the daily report of orders.
(automated delivery)");

# send the message
$smtp = Net::SMTP->new("smtp.mail.com");

#authenticate if required
$smtp->auth("login","passwd");

# Identify yourself to the smtp server
$smtp->mail('bogus@mail.com');

# The syntax for "To" is different in MIME::Entity and Net::SMTP
# The "to" here is the list of actual recipients and is not displayed
$smtp->to('user1@mail.com', 'user2@mail.com') || die "Bad address";

# Send the message and attachments
$smtp->data( [$msg->as_string] ) || die "mail not accepted";
$smtp->quit;

exit;


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

Date: Thu, 21 Nov 2002 14:12:49 +0000 (UTC)
From: Francesc Xavier Noria <fxn@hashref.com>
Subject: Re: Basic syntax question on using arrays returned from function
Message-Id: <aripl0$hp7$1@news.ya.com>

In article <slrnatpn5b.2jl.tadmc@magna.augustmail.com>, Tad McClellan wrote:

> Edward Wildgoose <Ed+nospam@ewildgoose.demon.co.uk@> wrote:
> 
>>> Extra parentheses are needed:
>>>
>>>     ($package->fn)[0];
> 
> 
> That is a "list slice", documented in the "Slices" section in:
> 
>    perldoc perldata

(I wrote the "Extra parentheses needed" thing).

Nope, it is list subscripting.

This is from "List value constructors":

     A list value may also be subscripted like a normal array.  You must put
     the list in parentheses to avoid ambiguity.  For example:
	
         # Stat returns list value.
         $time = (stat($file))[8];
			      
And this is from the very "Slices":

    You can also subscript a list to get a single element from it.
    
        $whoami = $ENV{"USER"};            # one element from the hash
        $parent = $ISA[0];                 # one element from the array
        $dir    = (getpwnam("daemon"))[7]; # likewise, but with list

which might confuse you because of the name of the section.

-- fxn


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

Date: Thu, 21 Nov 2002 09:16:35 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Basic syntax question on using arrays returned from function
Message-Id: <slrnatpu6j.2q2.tadmc@magna.augustmail.com>

Francesc Xavier Noria <fxn@hashref.com> wrote:
> In article <slrnatpn5b.2jl.tadmc@magna.augustmail.com>, Tad McClellan wrote:
>> Edward Wildgoose <Ed+nospam@ewildgoose.demon.co.uk@> wrote:


>>>>     ($package->fn)[0];
>> 
>> That is a "list slice"

> Nope, it is list subscripting.


Looks as if it is _both_ a floor wax and a dessert topping.[1]

Errr, I meant: Looks as if it is _both_ a list slice and list subscripting.


> This is from "List value constructors":
> 
>      A list value may also be subscripted like a normal array.  You must put
>      the list in parentheses to avoid ambiguity.


> And this is from the very "Slices":
> 
>     You can also subscript a list to get a single element from it.
>     
>         $whoami = $ENV{"USER"};            # one element from the hash
>         $parent = $ISA[0];                 # one element from the array
>         $dir    = (getpwnam("daemon"))[7]; # likewise, but with list


Let's quote the next sentence too:

   A slice accesses several elements of a list, an array, or a hash
   simultaneously using a list of subscripts.

So there are 3 kinds of slices, one for lists, one for arrays,
one for hashes:

   ()[]    # list slice

   @a[]    # array slice

   @a{}    # hash slice


> which might confuse you because of the name of the section.


which might confuse you (and/or me) because one of the 3 ways is 
also mentioned in a section with a different heading.   :-)  :-)




[1] from a Saturday Night Live skit.

-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Thu, 21 Nov 2002 16:55:07 -0000
From: "Clyde Ingram" <cingram@pjocsNOSPAMORHAM.demon.co.uk>
Subject: Re: Can someone recommend a beginner's book on Perl?
Message-Id: <arj32k$ktg$1$8300dec7@news.demon.co.uk>


"Kirk McElhearn" <kirk@mcelhearn.com> wrote in message
news:1flwhwj.1wqx5qfb3xp8nN%kirk@mcelhearn.com...
> Clyde Ingram <cingram@pjocsNOSPAMORHAM.demon.co.uk> wrote:
>
> > Agreed - the latest version is the O'Reilly "Perl CD Bookshelf  V3.0".
> > ISBN: 0596003897
<SNIP>
>
> Yes, but that's really expensive, and, frankly, I like dead-tree books.
>
> :-)
>
> Kirk

Right on.  You cannot read a CD in the bath, or while standing on a train.
As for the expense - it'll hit whether you buy the CD or the dead-trees.
Best solution - if you have an amenable employer - is to make a case for
your Project to fund the purchase.  That's how I got my hands of several
expensive, (sort of) useful items, including the O'Reilly Perl Development
Kit - not something I'd fund myself.




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

Date: Thu, 21 Nov 2002 09:48:54 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: disambiguating print (was Re: Basic syntax question on using arrays returned from function)
Message-Id: <slrnatq036.2q2.tadmc@magna.augustmail.com>

Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com> wrote:
> Edward Wildgoose wrote (Thursday 21 November 2002 14:44):


[somebody snipped:  using

   print +(), ...;

 to disambiguate the extent of print()'s argument list.
]


>> Now I need to read up on what the "+" does, 


It might be interesting to find out, but I think it is a poor
choice over the alternative (see below). 

I never ever choose that method of disambiguating (because it 
makes me pause and remember what unary plus does, and why I am 
using it there).  


> "Everything is not as difficult as it seems" -- or sort of.
> + is just plain arithmetic. 


Perl has two + operators, a unary op (positive sign) and
a binary op (addition).

We've been talking about the unary + in this thread.



The ambiguity problem we've been discussing is a consequence
of Larry's decision to make parenthesis around function
arguments optional rather than required.

If we happen to choose to use parens, then perl's job (finding
the end of the arg list) is easy, it just finds the matching
(perhaps nested) closing parenthesis.

It must use some other means of detecting the end of the arg
list for folks who choose to leave the parenthesis off.

When perl's parser sees "function name followed by open parenthesis",
it guesses that you are the kind of Perl programmer who likes to
put parens around arg lists, and it looks for the closing paren.

If it guessed wrong (ie. you've left the arg list parens off,
but have used parens for some _other_ purpose)
then it doesn't see the end of the arg list where you want
it to see it. In that case, you must somehow disambiguate it
so that perl won't resort to the (wrong) guess.


   print +(), ...;

avoids the guess because the parser did not see the
"function name followed by open parenthesis" pattern
in the first place, so it knows you are the "leave them off"
type of Perl programmer.


I feel it is much easier to remember (and to recall) if I
just choose to put parens around my arg list in the few
cases where I otherwise have the above pattern that 
triggers guessing by the parser:

   print( (), ... );  # now the guess turns out to be what I intended


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Thu, 21 Nov 2002 17:51:00 GMT
From: "Edward Wildgoose" <Ed+nospam@ewildgoose.demon.co.uk@>
Subject: Re: disambiguating print (was Re: Basic syntax question on using arrays returned from function)
Message-Id: <829D9.740994$Q5.93470@post-03.news.easynews.com>

This is a really clear answer.  Thankyou very much (and of course to all
others who answered!)

Cheers,

Ed




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

Date: Thu, 21 Nov 2002 15:50:17 GMT
From: echang@netstorm.net (ebchang)
Subject: Re: Format  a one line file to get two columns
Message-Id: <Xns92CD6E4745806echangnetstormnet@207.106.93.86>

tellaway@polymersealing.com (Tim Ellaway) wrote in 
<1ffffd4b.0211210430.6f9db003@posting.google.com>:

> Please could someone tell me how to format a file containing one
> continuous line so that there's two columns?
> 
> E.g. from this: 
> 
> -0.529766666666667 -8.89410873529075 -0.522816666666667
> -8.628319980362 0 0 4.9781502 12.02 5.0119999 12.05375
> 
> to this:
> 
> -0.529766666666667 -8.89410873529075
> -0.522816666666667 -8.628319980362
> 0 0
> 4.9781502 12.02
> 5.0119999 12.05375
> 

One way, not necessarily the most elegant.

#!perl
use warnings;
use strict;

my $line = <DATA>;
my @elements = split /\s/, $line;
my $i = 0;
print "$elements[$i++] $elements[$i++]\n" while ($i < @elements);

__DATA__
-0.529766666666667 -8.89410873529075 -0.522816666666667 -8.628319980362 0 0 
4.9781502 12.02 5.0119999 12.05375



-- 
EBC


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

Date: Thu, 21 Nov 2002 14:39:13 GMT
From: Noerd <n_joeller@sharaziilyar.com>
Subject: FREE Perl's memory??? Possible???
Message-Id: <3DDCEFF6.CD5A8E61@sharaziilyar.com>

I have a Perl script that modifies over 100,000 text strings. The entire
script takes 45 minutes!

The entire script is very efficient..... however, I just discovered one
thing:  If I split the entire script into 2 parts, each part only takes
10 minutes!!!  (total execution time of both halves = 20 minutes.....
shaving off 60% of the original execution time! wow!)

That told me that the script "slowed down," as it progressed. I added a
line of code to my script so it would show it's progress to my ssh
window. Sure enough, the script got slower as it moved along.

This tells me that perhaps (...here's my question).... my
memory-intensive script was bogging down my webhost's server's memory.

So, is there a line of code I can put in the script to periodically
FLUSH the memory. I'm not that proficient in Perl, but I would imagine
that if I placed a line of "counter" code in the middle of my script,
and then every 10,000 text-string-modifications, it would flush it's
memory.

Am I on the right track? Can someone help please? Here's what I'm
imagining:

$count = 0;
//beginning of code
print "Beginning code";
  if (blah) {
     execute manipulation
                if (blahblah) {
                manipulate some more
                       if (blahagain) {
                            do stuff
                                    if (++$count == 10000) {
                                         FLUSH MEMORY SOMEHOW // <--
need help here  :-)
                                         $count = 0; //reset counter
                                         }
                           }
                 do more stuff
                 }
     }
print "okay all done now";
//end of code

Thank you,
-Noerd J.



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

Date: Thu, 21 Nov 2002 17:54:49 +0000
From: news@roaima.freeserve.co.uk
Subject: Re: FREE Perl's memory??? Possible???
Message-Id: <9l6jra.3t.ln@moldev.cmagroup.co.uk>

Noerd <n_joeller@sharaziilyar.com> wrote:
> The entire script is very efficient..... [...]

> This tells me that perhaps (...here's my question).... my
> memory-intensive script was bogging down my webhost's server's memory.

Sounds like it's perhaps not as efficient as you'd like.

> So, is there a line of code I can put in the script to periodically
> FLUSH the memory.

Memory is (generally) allocated to your process and never returned to
the OS pool until that process exits. However, Perl does allocate and
free memory for its objects dynamically. This means that when a variable
goes out of scope, Perl will make its memory available for reuse by
another variable.

> Am I on the right track? Can someone help please? [...]

Your example suggests that you may have a large global hash or array in
which you manipulate your data, and so elements never really go out of
scope. In such a case, one way of freeing up items that you no longer
needing is to make them undef (or in the case of a hash, deleting them).

    my %bighash;
    for my $i (1 .. 1_000_000) {
	my $j = $i - 10_000;
	$bighash {$i} = $bighash {$i - 1} + 12;
	delete $bighash {$j} if $j > 0;		# Zap old items
    }

    my @bigarray;
    for my $i (1 .. 1_000_000) {
	my $j = $i - 10_000;
	$bigarray [$i] = "x" x 10_000;
	undef $bigarray [$j] if $j > 0;		# Zap old items
    }

Chris
-- 
@s=split(//,"Je,\nhn ersloak rcet thuarP");$k=$l=@s;for(;$k;$k--){$i=($i+1)%$l
until$s[$i];$c=$s[$i];print$c;undef$s[$i];$i=($i+(ord$c))%$l}


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

Date: Thu, 21 Nov 2002 11:42:49 -0600
From: Michael Carman <mjcarman@mchsi.com>
Subject: Re: FREE Perl's memory??? Possible???
Message-Id: <arj5st$57r1@onews.collins.rockwell.com>

On 11/21/02 8:39 AM, Noerd wrote:
>
> I have a Perl script that [...] takes 45 minutes!
> If I split the entire script into 2 parts, each part only takes
> 10 minutes!

Did you split the script itself or did you seperate the data into two runs?

> This tells me that perhaps (...here's my question).... my
> memory-intensive script was bogging down my webhost's
> server's memory.

That seems reasonable. Causing lots of disk swapping will slow things
down considerably.

> So, is there a line of code I can put in the script to periodically
> FLUSH the memory.

No. Memory management in Perl is automatic. It is not something that you
normally can (or should) worry about.

> I'm not that proficient in Perl, but I would imagine
> that if I placed a line of "counter" code in the middle of my script,
> and then every 10,000 text-string-modifications, it would flush it's
> memory.

If you can just throw away all your accumulated data periodically, then
you've probably been keeping things around that you shouldn't.

See perlfaq3 "How can I make my Perl program take less memory?" Make
sure you look at the latest (5.8) docs. Go to http://www.perldoc.com if
you have an older version installed locally.

-mjc



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

Date: 21 Nov 2002 10:57:07 -0800
From: jimr.long@worldnet.att.net (JimL.)
Subject: having problems parsing an error log.
Message-Id: <f16594a7.0211211057.79b7ff30@posting.google.com>

I am trying to write a script to capture some specifics of an error
log.
the log sample is as follows:

18 NOV 02  07:37:11AM^M
*** Software Alarms Cleared By System Manager^M
>>> INFORMATION ONLY^M
00000   14C09500 08000000 00000BC9 87970100   *................*^M
00010   9C2E7700                              *..w.            *^M
18 NOV 02  07:55:39AM^M
*** Illegal Number Of Bad Password Attempts Accessing Mailbox^M
>>> MONITOR CLOSELY^M
00000   24C00200 84000000 000027DB 87970100   *$.........'.....*^M
00010   90160000 DE000100 03000A28 12743983   *...........(.t9.*^M
00020   2E313700                              *.17.            *^M
Press "P" to print status log, "C" to clear log or any other key to
return to

My problem is, I need the date stamp, error title, and certain offsets
of only the Bad Password Disconnects. The output would need to be
something like...
18 NOV 02  07:55:39AM^M
*** Illegal Number Of Bad Password Attempts Accessing Mailbox^M
00010   90160000 DE000100 03000A28 12743983   
This is what I have so far:

open (ERRORLOG,"$inputfile")|| die "cant open $inputfile $!\n";
@errorlog=(<ERRORLOG>);
foreach $line(@errorlog){
	if ($line=~/^\d{2}\s{1}\D{3}.*/){
		$date=$line;
		chomp$date
		}
	if ($line=~/.*Bad.*Passw.*/){
		$error=$line;
		chomp $error;
		}
	if ($line=~/^00010\s{3}/){
		$mbx=$line;
		chomp $mbx;
		}
}
Now I'm STUCK!! Can anyone help get me kickstarted again?

Jim Long
NOC Tools /
Connectivity Sppt.
Supervisor / Coach
Avaya Inc.


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

Date: Thu, 21 Nov 2002 14:20:54 GMT
From: D <doris@chris.com>
Subject: Re: help this Newbie in Distress
Message-Id: <3DDCEBAB.32AD1736@chris.com>

What I liked about it was the "colons" to the left of the quoted mail. The
colons are what looks cool rather than those arrows.

By the way, regarding, "top-posting"...... how can ANYONE think "bottom posting"
is a good thing!?!  Nothing is more annoying than having to scroll down. Why not
see the answer right away? Of course, when I buy a magazine, I start at the back
first... hehe.. but I seriously  think I comprize at LEAST 60% of the
population!

However, let's all not start a "top post" vs "bottom post" thread here.....

Anyway... you did NOT answer my question. Maybe I didn't really want to
implement it. Maybe I just wanted to know the perl syntax for, "but not this." I
would guess it would look something like
$_ = lc!(cd|cd-rom|rom),
blah blah blah

And, I DID search and read for days trying to learn. I never post questions that
are stupid.

But thank you for your opinions.



Jay Tilton wrote:

> [ Please do not top-post replies. Please trim reply-quoted text to the
> minimum necessary to establish context. Please read the posting
> guidelines at http://mail.augustmail.com/~tadmc/clpmisc.shtml .  Posting
> chronology restored. ]
>
> D <doris@chris.com> wrote:
> : Jay Tilton wrote:
> : > D <doris@chris.com> wrote:
> : >
> : > : Here's the code that I've been using.
> : > :
> : > : $_ = lc,
> : > : s/\b(\w)/\u$1/g,
> : > : s/('S|\bOf| And| The)\b/\L$1/g,
> : > : s/\(P\b/(paperback/,
> : > : for $list_of_titles[2];
> : > :
> : > : I am wanting to avoid ADDING an extra line of code that will switch the
> : > : lowercase back to uppercase.
> : >
> : > Why is that?  It seems like an artificial restriction that excludes the
> : > most obvious, least intrusive modification to existing code.  After all,
> : > the code already uses s/// to handle a few special cases.  What's one
> : > more?
> :
> : Well, because I'm thinking that "plan A" would be "more efficient" (faster)



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

Date: Thu, 21 Nov 2002 15:04:58 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: help this Newbie in Distress
Message-Id: <3ddcf59b.3153270172@news.cis.dfn.de>

On Thu, 21 Nov 2002 14:20:54 GMT, D <doris@chris.com> wrote:

>By the way, regarding, "top-posting"...... how can ANYONE think "bottom posting"
>is a good thing!?!  Nothing is more annoying than having to scroll down. Why not
>see the answer right away? Of course, when I buy a magazine, I start at the back
>first... hehe.. but I seriously  think I comprize at LEAST 60% of the
>population!

*plonk*

>However, let's all not start a "top post" vs "bottom post" thread here.....

You already did and have already hit the bottom of my
killfile as a result.

>I never post questions that are stupid.

Candidate for famous last words.
-- 
Regards, Helgi Briem
helgi AT decode DOT is

                           A: Top posting
                           Q: What is the most irritating thing on Usenet?
                                           - "Gordon" on apihna


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

Date: Thu, 21 Nov 2002 16:12:50 GMT
From: "Bill Smith" <wksmith@optonline.net>
Subject: Re: How to print whatever text in Perl?
Message-Id: <6C7D9.11107$2v4.7930@news4.srv.hcvlny.cv.net>


"Peter Wu" <peterwu@hotmail.com> wrote in message
news:9acc2ac1.0211210133.5e165930@posting.google.com...
> Hello,
>
> My program reads the all contents of a ASCII file and prints them out.
> I notice that when there is something like $/ $. $), those characters
> disappear.
>
--snip--

Your example does not read an ASCII file.  Variable names ($. in this case)
are not expanded by a <> operation.

use strict;
use warnings;

my $str = <DATA>;
print $str;

__DATA__
Ends in $.

Bill




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

Date: 21 Nov 2002 13:25:34 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: I am Matthew D. Healy (was Re: Convert Perl script to C program (and Why was this group's name changed?))
Message-Id: <m3heeaeq5d.fsf_-_@mumonkan.sunstarsys.com>


[Forwarded with permission to comp.lang.perl.misc]

From: Matthew Healy <mdhealy@sprynet.com>
Subject: I am Matthew D. Healy
To: joe+usenet@sunstarsys.com
Date: Wed, 20 Nov 2002 09:09:18 -0500
Organization: Bristol-Myers Squibb

I has just come to my attention that somebody has
been using my old Yale University email address
for Usenet postings. I have not been at Yale since
June 1998.



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

Date: 21 Nov 2002 16:14:23 GMT
From: ctcgag@hotmail.com
Subject: Re: Improve my pivot program
Message-Id: <20021121111423.274$pE@newsreader.com>

sjblanky@yahoo.com (Scott Blankenship) wrote:


> I had a need to take a comma seperated matrix and pivot it.

It looks like you need to transpose it.  Pivot usually means something
else, I believe.

> The
> comments in my script below explain. While my perl script works, and I
> don't anticipate it being used for very large datasets, so performance
> isn't an issue, I don't really like it. It doesn't seem very
> perl-like. It lacks perl-elegance.
>
> Can you improve it?

I use this script, for whitespace rather than comma separated data:

my @data;
while (<STDIN>) {
  chomp;
  my @x=split;
  push @{$data[$_]}, $x[$_] foreach (0..$#x) ;
};
print join ("\t", @$_), "\n" foreach @data ;

It's behaviour may differ from what you want for degenerate cases
such as non-rectangular data.


Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service              New Rate! $9.95/Month 50GB


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

Date: Thu, 21 Nov 2002 17:12:02 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: passing address between classes - OO type question
Message-Id: <x7u1iag84c.fsf@mail.sysarch.com>

>>>>> "TvP" == Tassilo v Parseval <tassilo.parseval@post.rwth-aachen.de> writes:

  >> $foo = Bar->new() ;
  >> $bar = $foo();

  TvP> That's a syntax-error so I don't quite understand your point here.

that should be

	$bar = $foo ;

  >> $bar->method();

  >> notice the convenience return value and that it blesses the thingy and
  >> not the reference.
  >> 
  >> 'thingy' eq 'referent'.
  >> 
  >> damian invented the use of the term referent.

  TvP> Yet I don't see why this subtle distinction between reference and
  TvP> referent is needed here. In which way would the (apparently incorrect)
  TvP> idea which I have of objects so far affect my programs or render them
  TvP> even unfunctional?

it is both a conceptual issue and it can affect code if you are not
aware of it. the blessing affects the referent itself and not the
reference. so this works:

	bless \%foo ;
	(\%foo)->method() ;

	$bar = \%foo ;
	$bar->method() ;

%foo is the referent and $bar is the reference object.

an object is a reference to a blessed referent. bless takes a reference
as an argument but it modifies the underlying referent so that it knows
its class.

for most day to day uses conflating the reference and referent works out
ok but i am sure in the book object oriented perl there are examples of
where subtle issues can arise.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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


------------------------------
End of Perl-Users Digest V10 Issue 4155
***************************************


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