whitespace beginning and end

2006-02-22 Thread DBSMITH
Perlers

I need to remove any line that begins with \d+ yet end with \s*
Here is the data

_BEGIN_DATA_

   0 2005/09/23 17:25  221 100%  -il-o-b---U-  sf F02043
   1 2005/06/03 04:11  524 100%  -il-o-b---U-  sf F02017
   2 2005/06/10 00:12  592 100%  -il-o-b---U-  sf F02018
   3 2005/06/12 12:36  513 100%  -il-o-b---U-  sf H02001
   4 2005/03/05 05:11  766 100%  -il-o-b---U-  sf F02000
   5 2005/02/16 07:07  696 100%  -il-o-b---U-  sf F02003
   6 2005/02/26 02:02  604 100%  -il-o-b---U-  sf F02004
   7 2005/03/15 02:56  166 100%  -il-o-b---U-  sf H02003
   8 2005/03/12 05:30  750 100%  -il-o-b---U-  sf F02002
   9 2005/03/19 23:27  645 100%  -il-o-b---U-  sf F02005
  10 2005/03/20 16:46  432 100%  -il-o-b---Uf  sf F02006
  11 2005/03/24 03:59  121 100%  -il-o-b---U-  sf H02004
  12 2006/01/22 18:21  204 100%  -il-o-b---U-  sf F02060
  13 2006/01/25 13:55  400 100%  -il-o-b---U-  sf H02056
  14 2005/06/17 06:45  484 100%  -il-o-b---U-  sf F02019
  15 2005/03/24 04:03  119 100%  -il-o-b---U-  sf H02008
  16 2005/03/24 04:05  139 100%  -il-o-b---U-  sf H02009
  17 2005/03/24 04:02  125 100%  -il-o-b---U-  sf H02007
  18 2005/08/14 16:54  101 100%  -il-o-b---U-  sf H02043
  19 2005/06/23 04:53  487 100%  -il-o-b---U-  sf F02020
  20 2005/09/29 07:43  281 100%  -il-o-b---U-  sf F02041
  21 2005/04/02 22:48  592 100%  -il-o-b---U-  sf F02013
  22 2005/04/06 07:17  352 100%  -il-o-b---U-  sf H02019
  23 2005/04/10 01:38  631 100%  -il-o-b---U-  sf F02014
  24 2005/04/18 06:56  665 100%  -il-o-b---U-  sf F02015
  25 2005/04/21 07:28  251 100%  -il-o-b---U-  sf H02020
  26 2005/04/24 09:42  282 100%  -il-o-b---U-  sf H02022
  27 2005/04/27 04:36  603 100%  -il-o-b---U-  sf F02016
  28 2005/04/29 01:50  576 100%  -il-o-b---U-  sf F02007
  29 2005/05/04 04:41  569 100%  -il-o-b---U-  sf F02008
  30 2005/06/30 05:17  428 100%  -il-o-b---U-  sf F02022
  31 2005/05/09 17:43  421 100%  -il-o-b---U-  sf H02023
  32 2005/05/12 04:09  498 100%  -il-o-b---U-  sf F02009
  33 2005/06/25 08:35  100 100%  -il-o-b---U-  sf H02002
  34 2005/08/22 15:38  152 100%  -il-o-b---U-  sf H02044
  35 2005/06/30 19:32  224 100%  -il-o-b---U-  sf H02024
  36 2005/08/24 19:01  354 100%  -il-o-b---U-  sf F02037
  37 2005/07/06 12:57  476 100%  -il-o-b---U-  sf F02023
  38 2005/07/06 21:32  153 100%  -il-o-b---U-  sf H02025
  39 2005/05/25 09:03  191 100%  -il-o-b---U-  sf H02026
  40 2005/06/02 18:17  183 100%  -il-o-b---U-  sf H02027
  41 2005/06/14 14:13   97 100%  -il-o-b---U-  sf H02029
  42 2005/06/09 14:20  208 100%  -il-o-b---U-  sf H02030
  43 2005/06/22 08:04  212 100%  -il-o-b---U-  sf H02031
  44 2005/05/19 02:47  407 100%  -il-o-b---U-  sf F02010
  45 2005/06/27 20:56  114 100%  -il-o-b---U-  sf H02032
  46 2005/07/01 10:07  111 100%  -il-o-b---U-  sf H02033
  47 2005/07/08 11:49  196 100%  -il-o-b---U-  sf H02021
  48 2005/07/10 09:26   26 100%  -il-o-b---U-  sf H02028
  49 2005/07/13 05:06  421 100%  -il-o-b---U-  sf F02024
  50 2005/07/18 09:17  403 100%  -il-o-b---U-  sf F02025
  51 2005/07/20 17:28  179 100%  -il-o-b---U-  sf H02034
  52 2005/07/23 15:09  333 100%  -il-o-b---U-  sf F02026
  53 2005/07/29 10:24  379 100%  -il-o-b---U-  sf F02027
  54 2005/07/29 11:58  509 100%  -il-o-b---U-  sf F02011
  55 2005/08/04 05:00   68 100%  -il-o-b---U-  sf H02042
  56 2005/08/15 16:53   93 100%  -il-o-b---U-  sf H02038
  57 2005/08/05 11:12  335 100%  -il-o-b---U-  sf H02035
  58 2005/08/05 18:06   61 100%  -il-o-b---U-  sf H02036
  59 2005/08/08 20:55  435 100%  -il-o-b---U-  sf F02029
  60 2005/08/17 20:42  351 100%  -il-o-b---U-  sf F02028
  61 2005/08/11 16:10  199 100%  -il-o-b---U-  sf H02037
  62 2005/09/04 18:04   78 100%  -il-o-b---U-  sf H02049
  63 2005/09/07 01:35  339 100%  -il-o-b---U-  sf F02039
  64 2005/09/07 11:10  323 100%  -il-o-b---U-  sf F02030
  65 2005/08/31 13:06  267 100%  -il-o-b---U-  sf F02038
  66 2005/09/01 20:16  228 100%  -il-o-b---U-  sf H02045
  67 2005/09/11 13:02  202 100%  -il-o-b---U-  sf H02050
  68 2005/09/12 10:30   82 100%  -il-o-b---U-  sf H02046
  69 2005/09/13 08:44  340 100%  -il-o-b---U-  sf F02040
  70 2005/09/19 09:03  310 100%  -il-o-b---U-  sf F02042
  71 2005/10/04 12:42  286 100%  -il-o-b---U-  sf F02031
  72 2005/10/07 17:12  524 100%  -il-o-b---U-  sf H02053
  73 2005/10/10 13:23  288 100%  -il-o-b---U-  sf F02044
  74 none0   0%  -il-o---  sf H02005
  75 2005/10/14 15:26  234 100%  -il-o-b---U-  sf F02032
  76 2005/10/19 20:12  256 100%  -il-o-b---U-  sf F02033
  77 2005/10/25 11:46  273 100%  -il-o-b---U-  sf F02034
  78 2005/10/30 18:15  260 100%  -il-o-b---U-  sf F02035
  79 2005/11/02 14:28  521 100%  -il-o-b---U-  sf H02047
  80 

RE: whitespace beginning and end

2006-02-22 Thread DBSMITH






Do you mean like


 unless($_ =~ /^\s*\d+\s*$/){
print $_;
 }

?


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 22, 2006 2:36 PM
To: beginners@perl.org
Subject: whitespace beginning and end

Perlers

I need to remove any line that begins with \d+ yet end with \s*
Here is the data

_BEGIN_DATA_

snip

_END_DATA_


Here is what I came up with and it works but any other ideas b/c I am
unsure for every line with  2006/01/16 10:14  215 100%  -il-o-b---U-
sf
F02059
for example will have a length of 62 or more.
thank you!



snip code


BEGIN NEW RESPONSE
***
yes that will do it!


thank you




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




RE: tracking emails sent

2006-02-03 Thread DBSMITH
   
   
   





That last; statement makes certain of it. So, the second
email should be coming from a second instance of this script.
You need some mechanism to allow each instance of the script to
communicate with past instances or you'll need a better test
than elapsed time.

HTH,

Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328


--
BEGIN DEREK's RESPONSE

yes I know and this is proving to be a mind boggler.  thx...
As Tim stated from a previous email:

* What about using a hash to keep track of which strings you've already
gotten?

* What about keeping the line number and starting your reading at the
next line? (For example, use the $. variable, and then copy it to
$currentLine at the end of the current read, then do a next if $. =
$currentLine; at the beginning?

I was attempting to build a hash of arrays but the data became garbled aka
what I was looking for
was not there.  Using a hash from what Tim said made sense to me as in
keeping track what was already read.
I need to complete this for two different log files so I will start with
the more critical one.
thank you
derek


Here is my code:

#!/usr/bin/perl
require 5.6.1;

#use strict;
use warnings;
use diagnostics;
use File::Copy;
use MIME::Lite ();
use Logfile::Rotate ();
use Readonly;
Readonly::Scalar my $FIVE_MINUTES = '300';
$ENV{PATH}= qq(/asmcat/logs:/usr/bin:/usr/local/log);

my $now = time();
my $sfsdlog = qq(/asmcat/logs/samfs_dump.log);
my $fujiO   = qq(/fuji/original);
my $fujiC   = qq(/fuji/clinical);
my $hrtlab  = qq(/heartlab);
my $lv  = qq(/lanvision);
my (%strngs,$s) = ();
my @lines   = ();

sub dateme {
my ($month,$day,$year) = (localtime)[4,3,5];
sprintf (%02d/%02d/%02d, $month+1,$day,$year % 100);
}
my $date = dateme();

open (LOG, +$sfsdlog) || die could not open file: $sfsdlog $!;
for (;LOG;) {
 unless (/samfsdump:/) {
  push @lines, $_; #y\n//d;
}
}

#print @lines;

foreach my $i (@lines) {
   push @{ $strngs{$i} };
}

foreach $s (keys %strngs) {
   print [EMAIL PROTECTED] }\n;
}

My goal is to update a system log and then email when Errors: reaches a
value  zero  and only from todays date on.
Here is the output from just the unless construct.  The print
[EMAIL PROTECTED] }\n; data is the data at ther very botom but it is
garbled.

 __OUTPUT__

Starting InodeDump for /fuji/clinical : 02/02/06 12:00:00


samfsdump statistics:
Files:  885079
Directories:1012785
Symbolic links: 0
Resource files: 0
File segments:  0
File archives:  2534408
Damaged files:  0
Files with data:0
File  warnings: 545
Errors: 0
Unprocessed dirs:   0
File data bytes:0

dump Completed: 02/03/06 09:00:00

Starting Compressing and Copying: 02/02/06 09:00:00

C and C Completed: 02/03/06 09:00:00

All Dumps Completed: 02/03/06 09:00:00
+

 Starting Inode Dumps: 02/03/06 15:00:00
+++

Starting InodeDump for /slh1 : 02/03/06 15:00:00


dump Completed: 02/03/06 15:00:00

Starting InodeDump for /slh2 : 02/03/06 15:00:00


dump Completed: 02/03/06 15:00:00

Starting InodeDump for /heartlab : 02/03/06 15:00:00


samfsdump statistics:
Files:  1314880
Directories:141368
Symbolic links: 0
Resource files: 4
File segments:  0
File archives:  2628853
Damaged files:  0
Files with data:0
File  warnings: 442
Errors: 0
Unprocessed dirs:   0
File data bytes:0

dump Completed: 02/03/06 15:00:00

Starting Compressing and Copying: 02/03/06 15:00:00

C and C Completed: 02/03/06 15:00:00

Starting InodeDump for /fuji/original : 02/03/06 15:00:00



__END_OUTPUT__


__BEGIN_OUTPUT__ from  print [EMAIL PROTECTED] }\n;

Starting Compressing and Copying: 02/01/06 15:00:00



File archives:  2534408

Directories:140749

Files:  1308553

Starting InodeDump for /slh1 : 02/02/06 12:00:00

Directories:1017911

Starting InodeDump for /fuji/original : 02/02/06 18:00:00

Starting InodeDump for /heartlab : 02/02/06 00:00:00

Starting Compressing and Copying: 02/03/06 

RE: tracking emails sent

2006-02-03 Thread DBSMITH
   
   
   





[EMAIL PROTECTED] wrote:
:
: My problem is it mails once then it will mail again about the
: same string. I want it to only mail if it finds this string
: but be smart enough not to email again if it happens again
: within a certain time frame.

You'll need to save state somehow. This script only mails
once.

: foreach $tsm (@tsmdata) {
: if ($tsm =~ /AN[S,R]\d+/) {
: my $sub = A_STKV440 TSM node had 1 or more ... \n
: . Please rerun A_STKV440 backup;
: print $tsm,\n;
: #mailme($sub);
: last;
: }
: }

That last; statement makes certain of it. So, the second
email should be coming from a second instance of this script.
You need some mechanism to allow each instance of the script to
communicate with past instances or you'll need a better test
than elapsed time.

HTH,

Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328


--
well sort of but next time the script runs ( every 10 minutes) it finds the
same string Errors or the string ANS\d+||ANR\d+ and emails again.
Which is why I took Tims suggestion of a hash to reference back what was
already read.
see previous email. : )





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




tracking emails sent

2006-01-31 Thread DBSMITH
Perlers

I have Perl program that looks for a certain string in a inode backup log
file and if the log file is = 5 minutes old it will continue on. If it
finds this string from todays date 00:01 to 00:00 on it will email a
warning.
My problem is it mails once then it will mail again about the same string.
I want it to only mail if it finds this string but be smart enough not to
email again if it happens again within a certain time frame.
I was thinking of using Time::HiRes for some type of countdown, but seem
lost.
Any ideas?

Here is my working code:


use strict;
use warnings;
use MIME::Lite;
use Readonly;
Readonly::Scalar my $FIVE_MINUTES = '300';
Readonly::Scalar my $THREE_HOURS  = '259200';

my $now = time();
my $rt   = qq(/tmp/a_stkv440.runtime);
my $logfile = qq(/var/adm/inode_bkup_runtime.log);
my $mtime = (stat($logfile))[9];
my (@tsmdata)= ();
my ($counter,$tsm) = 0;


my $overide   = $SIG{__DIE__};  ## get error handler currently
assigned to die()
$SIG{__DIE__} =
sub {
my $error = shift;  ## error now holds the mesg passed
to die
$overide-($error) if (ref $overide);
mailme($error);
};

sub dateme {

our ($month,$day,$year) = (localtime)[4,3,5];
sprintf (%02d/%02d/%02d, $month+1,$day,$year % 100);
}

my $date = dateme();

sub mailme {

my $error = shift;
my $msg   = MIME::Lite-new(
From  = 'stkv440 [EMAIL PROTECTED]',
To= 'Derek Smith [EMAIL PROTECTED]',
Subject   = STKV440 INODE BKUP SCRIPT:\t$error,
Type  = 'multipart/related');

$msg-send;
}

if ( ($now - $mtime) = $FIVE_MINUTES ) {
open (FH, + $logfile) or die could not open bkup log file
$!;

for (;FH;) {

 if (/(?)$date/g .. /(?)Elapsed/g) {

 if (/(?)ANS\d+/ or /(?)ANR\d+/) {
   $tsmdata[$tsm++] = $_;
   $counter++;
 }
 }
   }

   foreach $tsm (@tsmdata) {
   if ($tsm =~ /AN[S,R]\d+/) {
   my $sub = A_STKV440 TSM node had 1 or more failures
while backing up inode files.
\n
   . Please rerun A_STKV440 backup;
   print $tsm,\n;
   #mailme($sub);
   last;
   }
   }


 close (FH) or warn was unable to close FH $!;
 close (RUNFILE) or warn was unable to close FH $!;
   }


__LOGFILE__


01/31/06 18:37:17
IBM Tivoli Storage Manager
Command Line Backup/Archive Client Interface
  Client Version 5, Release 3, Level 0.12
  Client date/time: 01/31/06   19:05:59
(c) Copyright by IBM Corporation and other(s) 1990, 2005. All Rights
Reserved.

Node Name: A_STKV440
Session established with server TSMSRV1: AIX-RS/6000
  Server Version 5, Release 3, Level 2.1
  Data compression forced off by the server
  Server date/time: 01/31/06   19:05:59  Last access: 01/31/06   18:35:33


Incremental backup of volume '/asmcat/backup/'
Normal File--   215,482,368 /asmcat/backup/clinical1.inode-backup
[Sent]
Normal File--   138,593,435 /asmcat/backup/heartlab.inode-backup.Z
[Sent]
Normal File--   138,604,133 /asmcat/backup/heartlab.inode-backup.Z.1
[Sent]
Normal File--   138,465,361 /asmcat/backup/heartlab.inode-backup.Z.2
[Sent]
Normal File--   138,283,492 /asmcat/backup/heartlab.inode-backup.Z.3
[Sent]
Normal File--   138,104,687 /asmcat/backup/heartlab.inode-backup.Z.4
[Sent]
Successful incremental backup of '/asmcat/backup/*'


Total number of objects inspected:   31
Total number of objects backed up:6
Total number of objects updated:  0
Total number of objects rebound:  0
Total number of objects deleted:  0
Total number of objects expired:  0
Total number of objects failed:   0
Total number of bytes transferred:861.09 MB
Data transfer time:  225.02 sec
Network data transfer rate:3,918.57 KB/sec
Aggregate data transfer rate:  9,766.24 KB/sec
Objects compressed by:0%
Elapsed processing time:   00:01:30

01/31/06 19:07:33

__END_LOGFILE__

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
614-566-4145


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




Re: use of uninitialized value....

2006-01-27 Thread DBSMITH
   
 Jay Savage
 [EMAIL PROTECTED] 
 l.com To 
   beginners perl beginners@perl.org 
 01/27/2006 11:20   cc 
 AM
   Subject 
   Re: use of uninitialized value  
   
   
   
   
   
   







On 1/26/06, JupiterHost.Net [EMAIL PROTECTED] wrote:
  The problem with defining your own versions of die, warn, croak, and
  carp is that only your code uses them.  If another module croaks or

 Thats why you put it in a module and use it in all your scripts and if
 it has not already been done and you can find a proper place for it to
 go, out it on CPAN so every can use it.


  dies then your custom error handling is not used.  This is why we have
  access to $SIG{__DIE__} and $SIG{__WARN__} (croak() and carp()
  internally use die() and warn() respectivly if I remember correctly).

 You are still defining your own versions of die, warn, croak, and carp
 and only your code uses still. Just differently :) but when you look
 at it later is it die()ing lile normal or custom or ??? having a good
 name for it makes it instantly recognizable and infinatelly easier to
 maintain:


The issue isn't who is setting the trap, the issue is how it behaves.
Defining subs as you have done only catches the errors you expect to
catch. If Net::FTP has a connection problem, it returns and error and
then your script calls your custom routine wich logs, emails, and then
calls die. If Net::FTP runs into an internal problem within the module
itself, though, it calls the default die which complanis to STDOUT and
quits. No log report. No email. Just silence unless you happen to be
sitting in front of the console when it happens. If you take the time
to trap the signals, though, when Net::FTP calls die interanlly, it
will get your trapped $SIG{__DIE__}, the error will be logged, and
you'll get an email.

The only way to duplicate this with a plain old sub would be to wrap
everything in eval blocks which is a pain, to say the least.

 For example:

 Say you're sorting through a 1200 line script I wrote 9 months ago and
 find this:

 die oops I did it again: $!;


 Now is it:
   a) standard die
   b) send the error to email
   c) INSERT it into a database
   d) write it to a file
   e) format it for HTML
   f) none of the above
   g) ask me, the original author, and hope I remember what sort of crack
 I was on that day (IE not gonna happen ;p)


It's die. There's no mystery about it. Siganls can only have one trap
at a time. 'Ctrl-s $SIG{__DIE__} = ' (or appropriate search for your
text editor) will make it all clear. You have to find where the
subroutnie is defined either way--_my_email_error is nice, but it
still doesn't tell you who's being emailed--and it's no more difficult
to find the code where the signal is trapped than it is to find the
code where the subroutine is defined. Signal trapping is just defining
a subrouting with a particular name. Why is finding the line that
looks like sub _my_weird_carp { easier than finding the line that
looks like $SIG{__DIE__} = sub{? if anything, the caps stick out in
the code and make handler defs easier to spot.

 However if it had been

 _die_to_email(oops I did it again: $!);

 _die_to_sql(oops I did it again: $!);

 _die_to_file(oops I did it again: $!);

 _die_to_html(oops I did it again: $!);

 Now I know *exactly* whats going on and pretty much where to look to see
 what its doing.

 Or at least, even _die(oops I did it again: $!); (or in my initial
 example _my_die()) tells me its no normal die()

 You're right that %SIG is there so we can have our way with it (and is
 really handy when dealing with forks and children etc) but it doesn't
 mean we should (more ambiguous, more error prone, harder to maintain,
 etc etc)


No, %SIG is there because it's a standard best practice to use signals
to do the jobs they're designed for, and because reinventing the wheel
is pretty much universally frowned upon. Using standard features and
standard nomenclature facilitates maintenace, because not everyone
knows what the intention of _die_to_email() may be. Worse you may 

Re: use of uninitialized value....

2006-01-27 Thread DBSMITH
   
 Chas Owens
 [EMAIL PROTECTED] 
 .com  To 
   [EMAIL PROTECTED]
 01/27/2006 11:47  [EMAIL PROTECTED]
 AM cc 
   beginners perl beginners@perl.org 
   Subject 
   Re: use of uninitialized value  
   
   
   
   
   
   






 Thanks Jay for the hopefully final wrap up to the uninteded long email
 thread.  This was a good thing however b/c
 I learned something new in this wonderful thing called Perl.
 I agree and it make sense to use   $SIG{__DIE__} for obvious reasons.
 But in my test code I am getting Useless use of hash element in void
 context at line 30.
 which is the line that has the   $overide-{$error}.  But when I comment
 out the mailme call I do not get this warning.

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


sub mailme {

 my $sub =  shift;

why aren't you using $sub (which I would rename $message or $error) in
the body of the message?

 my $msg =  MIME::Lite-new(
 From= 'pshrapprd [EMAIL PROTECTED]',
 To  = 'Derek Smith [EMAIL PROTECTED]',
 Subject = 'HRIS FTP Inbound to monster.com had
 problems and or failed!',
 Type= 'multipart/related');

 #$msg-attach(
 #Type= 'TEXT',
 #Disposition = 'attachment',
 #Path= $ftplog,
 #Filename= $ftplog);
 $msg-send;
 }




 my $overide   = $SIG{__DIE__}; ## get error handler currently assigned to
 die()
 $SIG{__DIE__} = sub {
 my $error = shift;

$override is a coderef, not a hashref.  That is if it is set at all.
If no handler has been previously registered with __DIE__ then it will
be blank.  That is why there is a ref check.  Your problem is that you
are using curly braces {} instead of parentheses ().

 $overide-{$error} if (ref $overide);
 mailme($error);
 };

 open (LOG, +/var/log/derek) or die Was unable to open file: $!;
 close (LOG);


BEGIN NEW RESPONSE:

no reason I was just testing so yes I am using $error passed to my mail
routine.
understood override is a code reference which explains ( ) as opposed to {
}
Kudos to Chas as he has helped quir a bit!

thanks again dude!
derek


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




Re: use of uninitialized value....

2006-01-26 Thread DBSMITH
   
 Tom Phoenix   
 [EMAIL PROTECTED] 
 omTo 
 Sent by:  [EMAIL PROTECTED]
 [EMAIL PROTECTED] [EMAIL PROTECTED]
 .com   cc 
   beginners@perl.org  
   Subject 
 01/25/2006 12:26  Re: use of uninitialized value  
 PM
   
   
   
   
   









 My problem seems to be within the Net::FTP module.  I have intentionally
 modified my password so that my error routines can be tested, but once
the
 login
 piece fails it continues on,  when I would expect that it should die at
the
 code in red.

I don't see any code in red.

 The uninitialized value is $OHMONSTER, but the FTP piece is
 not exiting.

 print step 6 for loop\n;
 foreach ($ftp-ls()) {
 if (/${$fref}\d+\w+/)  {
$OHMONSTER = $_;
last;
 }
 }

If the test in the if statement never returns true, $OHMONSTER will
stay uninitialized. Is that the problem you're having? Check to see
whethere it's defined before you continue, if that matters. Hope this
helps!

**
**

Yes indeed the problme is within the OHMONSTER variable.  I determined this
through a print.
I was able to rid of the error and exit with a RC of zero when any part of
the Net::FTP failed by using a
return.  Here is what I did:

print step 1 open log\n;
open (FTPLOG, $ftplog) || do {print FTPLOG \ncould not
open file: $ftplog $!};
print step 2 init ftp\n;
my $ftp = Net::FTP-new($remotehost, Debug = 10)
|| do {print FTPLOG \nCannot connect to $remotehost: $!,
mailme(); return};
print step 3 login\n;
   $ftp-login($user, $pass) || do {print FTPLOG \nLogin
failed!: $!, mailme(); return};
print step 4 print login failed then set bin\n;
$ftp-binary();
print step 5 cd directory\n;
$ftp-cwd($remotedir) || do {print FTPLOG \nCWD to folder
outbound failed!: $!, mailme(); return};
print step 6 for loop\n;
foreach ($ftp-ls()) {
if (/${$fref}\d+\w+/)  {
   $OHMONSTER = $_;
   last;
}
else {
   print FTPLOG \nFTP ls() or match failed...file will
not be renamed\n;
   last;




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




Re: use of uninitialized value....

2006-01-26 Thread DBSMITH

snip
 my $ftp = Net::FTP-new($remotehost, Debug = 10)
 || do {print FTPLOG \nCannot connect to $remotehost:
$!,
 mailme(); return};
snip

This is a bit off topic, but I can't look at code like this without
suggesting the following alternative:

near the top of your program say:

{
my $olddie = $SIG{__DIE__};
$SIG{__DIE__} = sub {
my $error = shift;
$olddie-{$error} if ref $olddie;
mailme($error);
#other error stuff here
};
}

Then for the rest of your program you can say

my $ftp = Net::FTP-new($remotehost, Debug = 10) or
die Cannot connect to $remotehost: $!;

This allows you to have a complicated error procedure that is common
to anywhere you use die().  It also makes your code cleaner.  If you
want the same functionality without the program ending you can assign
your error handler to $SIG{__WARN__} and use warn() instead.

*
*

I appreciate the suggestion, but if there is a problem I want the progam to
email then die.  So I would replace

the || do lines in the ftp section
with a routine call to?  :

my $olddie = $SIG{__DIE__};
$SIG{__DIE__} = sub {
my $error = shift;
$olddie-{$error} if ref $olddie;
mailme($error);
#other error stuff here
};


Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
614-566-4145


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




Re: use of uninitialized value....

2006-01-26 Thread DBSMITH

 the || do lines in the ftp section
 with a routine call to?  :

 my $olddie = $SIG{__DIE__};
 $SIG{__DIE__} = sub {
 my $error = shift;
 $olddie-{$error} if ref $olddie;
 mailme($error);
 #other error stuff here
 };

snip

No, that defines the override of the default behavior of the die()
command (see perldoc -f die).  The || do { blah }; turns into or
die 'message';  You put all of the blah code in the override.

***
***

ok I read the perldoc and this seems to be the ideal way, but when any
condition fails, meaning
a connection fails, a login fails or a cwd fails I want to update the log
with the appropriate message for each failed
condition.  Using this ONE way your way will not do this for me instead I
will have to write THREE of these blocks  once for each failure...
UNLESS I can put an if in this routine like so:

 my $olddie = $SIG{__DIE__};
 $SIG{__DIE__} =

 sub {
 my $error = shift;
 $olddie-{$error} if ref $olddie;


 #other error stuff as below
  if ($RC == 0) {
  print FTPLOG message about connection
  mailme($error);
  }
  elif {
   ($RC == 1) {
   print FTPLOG message about login
   mailme($error);
  }
  else {
   ($RC == 2) {
   print FTPLOG message about cwd
   mailme($error);
 };

Here would be the ftp calls

my $ftp = Net::FTP-new($remotehost, Debug = 10) or
die  Cannot connect to $remotehost: $!, my $RC=0;

$ftp-login($user, $passs ) or die Login failed $!, my $RC=1;

$ftp-cwd ($remotedir) or die CWD failed $!, my $RC=2

Does this make sense logically?

thanks again,
derek


Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams



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




use of uninitialized value....

2006-01-25 Thread DBSMITH
All,

My problem seems to be within the Net::FTP module.  I have intentionally
modified my password so that my error routines can be tested, but once the
login
piece fails it continues on,  when I would expect that it should die at the
code in red. The uninitialized value is $OHMONSTER, but the FTP piece is
not exiting.
 Any help please?
thanks
derek


#!/usr/bin/perl
use strict;
use warnings;
use Net::FTP;
use MIME::Lite;

my ($ftplog,$fref);
my $OHMONSTER;
my $RENAMED = q/OhioHealth.xml/;
my ($monster_date,$passed_new_date) = 0;

sub new_date {

my ($year,$month,$day) = (localtime)[5,4,3];
sprintf (%04d%02d%02d, ($year += 1900), $month+1,$day);
}
$passed_new_date = new_date();


sub new_date_append {

return $monster_date = OhioHealth$passed_new_date;
}
$fref = \new_date_append();


   sub mailme {

my $sub = shift;
my $msg = MIME::Lite-new(
From= 'pshrapprd [EMAIL PROTECTED]',
To  = 'Derek Smith [EMAIL PROTECTED]',
#To = 'PsoftHR Group [EMAIL PROTECTED]',
Subject = 'HRIS FTP Inbound to monster.com had
problems an,
Type= 'multipart/related');

$msg-attach(
Type= 'TEXT',
Disposition = 'attachment',
Path= $ftplog,
Filename= $ftplog);
$msg-send;
}


sub signal {

if ($? == -1) {
print failed to execute: $!\n;
mailme($!);
}
elsif ($?  127) {
printf child dies with signal %d, %s coredump\n,
($?  127), ($?  128) ? 'with core' :
'without;
mailme($!);
}
elsif ( $?  8) {
printf child exited with value %d\n, $?  8;
mailme($!);
}
else {
 mailme();
}

}



   sub ftpme {

my $RENAMED = q/OhioHealth.xml/;
my $OHMONSTER;
my $remotehost=ftp.monster.com;
my $remotedir=outbound;
my $user=xx;
my $pass=;

$ftplog=/psofthr/hr88prd/intf/monster/log/interface_monster.log;

print step 1 open log\n;
open (FTPLOG, $ftplog) || do {print FTPLOG \ncould not
ope;
print step 2 init ftp\n;
my $ftp = Net::FTP-new($remotehost, Debug = 10)
|| do {print FTPLOG \nCannot connect to $remotehost: $!,
mail;
print step 3 login\n;
   $ftp-login($user, $pass) || do {print FTPLOG \nLogin
failed!: ;
print step 4 print login failed then set bin\n;
$ftp-binary();
print step 5 cd directory\n;
$ftp-cwd($remotedir);
print step 6 for loop\n;
foreach ($ftp-ls()) {
if (/${$fref}\d+\w+/)  {
   $OHMONSTER = $_;
   last;
}
}

#$ftp-rename($OHMONSTER, $RENAMED) or do {print FTPLOG
\n;
line 99print OHMONSTER:\t,$OHMONSTER,\n,RENAMED\t:,$RENAMED,\n;
line 100  $ftp-rename($OHMONSTER,$RENAMED);
 #signal($!), select( (select(FTPLOG), $|=1 ) [0] ); };
 $ftp-quit;
}


   if ( $passed_new_date and $$fref ) {
   ftpme();
   }
   #else {
   #   mailme();
   #
   #}

_ERROR_

Net::FTP Net::FTP(2.75)
Net::FTP   Exporter(5.566)
Net::FTP   Net::Cmd(2.26)
Net::FTP   IO::Socket::INET(1.26)
Net::FTP IO::Socket(1.27)
Net::FTP   IO::Handle(1.21)
Net::FTP=GLOB(0x203f5560) 220 ftp101 Microsoft FTP Service (Version
5.0).
Net::FTP=GLOB(0x203f5560) user xohealthxftp
Net::FTP=GLOB(0x203f5560) 331 Password required for xohealthxftp.
Net::FTP=GLOB(0x203f5560) PASS 
Net::FTP=GLOB(0x203f5560) 530 User xohealthxftp cannot log in.
step 1 open log
step 2 init ftp
step 3 login
Net::FTP=GLOB(0x203f5560) TYPE I
Net::FTP=GLOB(0x203f5560) 530 Please login with USER and PASS.
Net::FTP=GLOB(0x203f5560) CWD outbound
Net::FTP=GLOB(0x203f5560) 530 Please login with USER and PASS.
Net::FTP=GLOB(0x203f5560) PORT 192,168,97,144,169,122
Net::FTP=GLOB(0x203f5560) 200 PORT command successful.
Net::FTP=GLOB(0x203f5560) NLST
Net::FTP=GLOB(0x203f5560) 530 Please login with USER and PASS.
Use of uninitialized value in print at interface_monster_IN2 line 99.
Use of uninitialized value in string at interface_monster_IN2 line 100.
Net::FTP=GLOB(0x203f5560) RNFR
Net::FTP=GLOB(0x203f5560) 530 Please login with USER and PASS.
Net::FTP=GLOB(0x203f5560) QUIT
Net::FTP=GLOB(0x203f5560) 221  Leaving Monster.Com
step 4 print login failed then set bin
step 5 cd directory
step 6 for loop
OHMONSTER:

rename file on ftp server

2006-01-24 Thread DBSMITH
All,

I have a task to complete for a user.  He wants me to rename a file on a
remote server so that he can pick it up.
I am trying to use a reg exp or a blog but this is not working.  Any tricks
of the perl trade will be mucho appreciated!
The file format is OhioHealthyyymmdd[0-9].xml
The [0-9] is a 6 digit PID I assume but changes every time the file is
created.
So the filename for example looks like OhioHealth20040124989893.xml

thank you!

#!/usr/bin/perl
use strict;
use warnings;
use Net::FTP;
use MIME::Lite;

my ($monster_date,$fref) = 0;

sub new_date {

my ($year,$month,$day) = (localtime)[5,4,3];
sprintf (%04d%02d%02d, ($year += 1900), $month+1,$day);
}
my $passed_new_date = new_date();

sub new_date_append {

return $monster_date = OhioHealth$passed_new_date;
}
   $fref = \new_date_append();


sub ftpme {

my $remotehost=ftp.monster.com;
my $remotedir=outbound;
my $user=;
my $pass=;
my $data=$$fref;
my
$ftplog=/psofthr/hr88prd/intf/monster/log/interface_monster.log;

open (FTPLOG, $ftplog) || die could not open file:
$ftplog $!;
my $ftp = Net::FTP-new($remotehost, Debug = 10)
|| do {print FTPLOG \tCannot connect to $remotehost:
monster.com: $!; };
$ftp-login($user, $pass) || do {print FTPLOG \tLogin
failed!: $!; };
$ftp-binary();
$ftp-cwd($remotedir);
$ftp-rename($$fref\[0-9].xml, OhioHealth.xml) || do
{print FTPLOG \tFTP get from monster.com failed!: $!; };
$ftp-quit;
}

   if ( $passed_new_date and $$fref ) {
   print YES\n;
   print $passed_new_date,\n;
   print $$fref,\n;
   ftpme();
   }
#   else {
#   email warning
#   }

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams



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




RE: rename file on ftp server

2006-01-24 Thread DBSMITH
   
 Ryan Frantz 
 [EMAIL PROTECTED] 
 med-llc.com   To 
   [EMAIL PROTECTED],   
 01/24/2006 03:17  beginners@perl.org
 PM cc 
   
   Subject 
   RE: rename file on ftp server   
   
   
   
   
   
   









 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, January 24, 2006 3:05 PM
 To: beginners@perl.org
 Subject: rename file on ftp server

 All,

 I have a task to complete for a user.  He wants me to rename a file on
a
 remote server so that he can pick it up.
 I am trying to use a reg exp or a blog but this is not working.  Any
 tricks
 of the perl trade will be mucho appreciated!
 The file format is OhioHealthyyymmdd[0-9].xml
 The [0-9] is a 6 digit PID I assume but changes every time the file is
 created.
 So the filename for example looks like OhioHealth20040124989893.xml

 thank you!

 #!/usr/bin/perl
 use strict;
 use warnings;
 use Net::FTP;
 use MIME::Lite;

 my ($monster_date,$fref) = 0;

 sub new_date {

 my ($year,$month,$day) = (localtime)[5,4,3];
 sprintf (%04d%02d%02d, ($year += 1900), $month+1,$day);
 }
 my $passed_new_date = new_date();

 sub new_date_append {

 return $monster_date = OhioHealth$passed_new_date;
 }
$fref = \new_date_append();


 sub ftpme {

 my $remotehost=ftp.monster.com;
 my $remotedir=outbound;
 my $user=;
 my $pass=;
 my $data=$$fref;
 my
 $ftplog=/psofthr/hr88prd/intf/monster/log/interface_monster.log;

 open (FTPLOG, $ftplog) || die could not open
file:
 $ftplog $!;
 my $ftp = Net::FTP-new($remotehost, Debug = 10)
 || do {print FTPLOG \tCannot connect to $remotehost:
 monster.com: $!; };
 $ftp-login($user, $pass) || do {print FTPLOG \tLogin
 failed!: $!; };
 $ftp-binary();
 $ftp-cwd($remotedir);
 $ftp-rename($$fref\[0-9].xml, OhioHealth.xml) ||
do

To match one or more of the previous characters, use the '+' operator:

$$fref\[0-9]+.xml

 {print FTPLOG \tFTP get from monster.com failed!: $!; };
 $ftp-quit;
 }

if ( $passed_new_date and $$fref ) {
print YES\n;
print $passed_new_date,\n;
print $$fref,\n;
ftpme();
}
 #   else {
 #   email warning
 #   }

 Derek B. Smith
 OhioHealth IT
 UNIX / TSM / EDM Teams



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

*
*
your solution does not work I am not a noob so I have tried this
already.
thank you though!

__DEBUG__

FTP is returning the RNFR command OhioHealth20060124[0-9]+.xml
550 OhioHealth20060124[0-9]+.xml: The system cannot find the file
specified.




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




Re: rename file on ftp server

2006-01-24 Thread DBSMITH
   
 Jay Savage
 [EMAIL PROTECTED] 
 l.com To 
   [EMAIL PROTECTED]
 01/24/2006 04:24  [EMAIL PROTECTED]
 PM cc 
   
   Subject 
   Re: rename file on ftp server   
   
   
   
   
   
   







On 1/24/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

  Ryan Frantz
  [EMAIL PROTECTED]
  med-llc.com
To
[EMAIL PROTECTED],
  01/24/2006 03:17  beginners@perl.org
  PM
cc


Subject
RE: rename file on ftp server

  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, January 24, 2006 3:05 PM
  To: beginners@perl.org
  Subject: rename file on ftp server
 
  All,
 
  I have a task to complete for a user.  He wants me to rename a file on
 a
  remote server so that he can pick it up.
  I am trying to use a reg exp or a blog but this is not working.  Any
  tricks
  of the perl trade will be mucho appreciated!
  The file format is OhioHealthyyymmdd[0-9].xml
  The [0-9] is a 6 digit PID I assume but changes every time the file is
  created.
  So the filename for example looks like OhioHealth20040124989893.xml
 
  thank you!
 
  #!/usr/bin/perl
  use strict;
  use warnings;
  use Net::FTP;
  use MIME::Lite;
 
  my ($monster_date,$fref) = 0;
 
  sub new_date {
 
  my ($year,$month,$day) = (localtime)[5,4,3];
  sprintf (%04d%02d%02d, ($year += 1900), $month+1,$day);
  }
  my $passed_new_date = new_date();
 
  sub new_date_append {
 
  return $monster_date = OhioHealth$passed_new_date;
  }
 $fref = \new_date_append();
 
 
  sub ftpme {
 
  my $remotehost=ftp.monster.com;
  my $remotedir=outbound;
  my $user=;
  my $pass=;
  my $data=$$fref;
  my
  $ftplog=/psofthr/hr88prd/intf/monster/log/interface_monster.log;
 
  open (FTPLOG, $ftplog) || die could not open
 file:
  $ftplog $!;
  my $ftp = Net::FTP-new($remotehost, Debug = 10)
  || do {print FTPLOG \tCannot connect to $remotehost:
  monster.com: $!; };
  $ftp-login($user, $pass) || do {print FTPLOG \tLogin
  failed!: $!; };
  $ftp-binary();
  $ftp-cwd($remotedir);
  $ftp-rename($$fref\[0-9].xml, OhioHealth.xml) ||
 do

 To match one or more of the previous characters, use the '+' operator:

 $$fref\[0-9]+.xml

  {print FTPLOG \tFTP get from monster.com failed!: $!; };
  $ftp-quit;
  }
 
 if ( $passed_new_date and $$fref ) {
 print YES\n;
 print $passed_new_date,\n;
 print $$fref,\n;
 ftpme();
 }
  #   else {
  #   email warning
  #   }
 
  Derek B. Smith
  OhioHealth IT
  UNIX / TSM / EDM Teams

 your solution does not work I am not a noob so I have tried this
 already.
 thank you though!

 __DEBUG__

 FTP is returning the RNFR command OhioHealth20060124[0-9]+.xml
 550 OhioHealth20060124[0-9]+.xml: The system cannot find the file
 specified.


There are actually a couple of issues here. The one that's causing the
error is interpolation. you're passing a double-quoted string to
$ftp-rename(), so perl is doing interpolation before it passes the
string off to the system. As you've probably noticed, single-quoting
won't work, either, because then the systems gets a literal, which
yeilds more-or-less the same result. There are probably ways around
this with double escapes but why bother? Thry something like this:

my @dir = $ftp-ls();
my @matches = grep (/$$fref[0-9].xml/, @dir);
$ftp-rename(@matches[0], OhioHealth.xml) || log();

The other problem with this is that I don't see anything to prevent
multiple files from matching, or any logic to choose between the

Re: fileno

2006-01-11 Thread DBSMITH
   
 Tom Phoenix   
 [EMAIL PROTECTED] 
 omTo 
 Sent by:  [EMAIL PROTECTED]
 [EMAIL PROTECTED] [EMAIL PROTECTED]
 .com   cc 
   
   Subject 
 01/11/2006 03:57  Re: fileno  
 PM
   
   
   
   
   







On 1/11/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 I kow how to do this install on a *nix machine, but how do I install this
 module on a windows machine?

If you've got a C compiler and a few related tools, you can compile
the module on Windows, assuming that the code is compatible. But
you'll probably be happier if you can get a PPM from somebody else. It
looks as if that module isn't on ActiveState's site, darn it. That
seems to be due to Canadian law, and perhaps not due to
incompatibility.

http://aspn.activestate.com/ASPN/Downloads/ActivePerl/PPM/Repository

You're not the only one to have noticed this...


http://sqlservercentral.com/cs/blogs/brian_kelley/archive/2005/12/16/376.aspx


And that led me to this. Does this suggestion do anything?

http://www.pavleck.com/modules.php?name=Contentpa=showpagepid=5

Good luck with it!

--Tom Phoenix

***
***

Hi Tom,

great information thank you.
so is the last link what I need to do inorder to get Crypt::GPG instaled on
a Win32 box?

thanks again
derek

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams



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




Re: pack an array

2006-01-03 Thread DBSMITH
what is this pack actually doing compressing the data in each element
or the entire array or both?


Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams




   
 Gerard Robin  
 [EMAIL PROTECTED] 
 doo.frTo
   beginners perl beginners@perl.org
 01/02/2006 06:04   cc
 PM
   Subject
   Re: pack an array   
   
   
   
   
   
   




On Mon, Jan 02, 2006 at 10:07:44AM -0800, Tom Phoenix wrote:

  my @pack;
  my $empties = 0;
  foreach my $item (@array) {
  if ($item eq '') {# empty string
  $empties++;
  } else {
  push @pack, $item;
  }
  }

Thanks, very nice. It's difficult (for me ;-)) to think in Perl ...
Thanks also for the other hints.
--
GĂ©rard


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




fileno

2006-01-03 Thread DBSMITH
Perl'ers

I am using gpg within a Perl program to decrypt some data files.  In order
to decrypt a passphrase has to be passed to the gpg binary and I choose to
use fileno function but it is hanging waiting on the passphrase.  I am
trying to pass the passphrase to the binary via fileno.
Any ideas on how to fix this?

thank you


The equivalent Unix command would be

cat file_with_passphrase_in_it  | gpg - -passphrase-fd=0 - -decrypt - -
output decrypted file encrypted file

Here is my Perl code:

use strict;
use warnings;
use diagnostics;
use Net::FTP;
require 5.8.0;
$ENV{PATH} = qq(C:\\Perl\\bin:C:\\Program Files\\GNU\\GnuPG\\);

my $p = q/--passphrase-fd=/;
my $de= q/--decrypt/;
my $outp  = q/--output/;
my $gpgbinary = qq(C:\\Program Files\\GNU\\GnuPG\\gpg);
my $txtfile   = qq(C:\\Program Files\\GNU\\GnuPG\\decrypted);
my $ascfile   = qq(C:\\Program Files\\GNU\\GnuPG\\tstfile.asc);
my $pass  = qq(C:\\temp\\pass.txt);

open (PASS, +$pass) or die was unable to open FH $!;
system($gpgbinary, $p . fileno(PASS),
   $de, $outp, $txtfile, $ascfile);

close (PASS) or warn was unable to close pass FH $!;

_END_CODE_

_BEGIN_OUTPUT_


Reading passphrase from file descriptor 3 ...


You need a passphrase to unlock the secret key for
user: derek smith
2048-bit ELG-E key, ID 985DB557, created 2005-12-30 (main key ID 4A673EF3)

gpg: encrypted with 2048-bit ELG-E key, ID 985DB557, created 2005-12-30
  derek smith
gpg: public key decryption failed: bad passphrase
gpg: decryption failed: secret key not available
Press any key to continue . . .

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams



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




Re: pack an array

2006-01-03 Thread DBSMITH
   
 JupiterHost.Net 
 [EMAIL PROTECTED] 
 st.netTo 
   beginners perl beginners@perl.org 
 01/03/2006 11:28   cc 
 AM
   Subject 
   Re: pack an array   
   
   
   
   
   
   









[EMAIL PROTECTED] wrote:
 what is this pack actually doing compressing the data in each element
 or the entire array or both?

Derek, I know you know about perldoc, I've seen it recommended to you
dozens of times :)

perldoc -f pack

Takes a LIST of values and converts it into a string using the
rules given by the TEMPLATE.  The resulting string is the
concatenation of the converted values

I've also seen people ask you not to top post ;p

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





I know but sometimes I forget.
sorry and thx for the explan.



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




perl net ftp on windows

2005-12-29 Thread DBSMITH
I cannot figure out how Net::FTP set its local current directory for gets
of remote files?  Does anyone know?
I want to get remotefile from remotehost using:
but I want to place this file in $localdir not in what Net::FTP claims to
be

get ( REMOTE_FILE [, LOCAL_FILE [, WHERE]] )
  Get REMOTE_FILE from the server and store locally. LOCAL_FILE may be
  a filename or a filehandle. If not specified, the file will be stored
  in the current directory with the same leafname as the remote file.


  If WHERE is given then the first WHERE bytes of the file will not be
  transferred, and the remaining bytes will be appended to the local
  file if it already exists.


  Returns LOCAL_FILE, or the generated local file name if LOCAL_FILE is
  not given. If an error was encountered undef is returned.

please help!

thx
derek

#!/usr/bin/perl


use strict;
use warnings;
use diagnostics;
use Net::FTP;
require 5.8.0;
$ENV{PATH} = qq(C:\\Perl\\bin:C:\\Documents and Settings\\mh-hl7:);

my $p= qq(--passphrase-fd 0);
my $de= qq(--decrypt);
my $outp= qq(--output);
my $MHfile= qq(C:\\Documents and Settings\\mh-hl7\\MHFM.txt.asc);
my $pass= qq(C:\\temp\\pass.txt);

sub ftpme {
  my $remotehost = 216.54.146.8;
  my $remotedir  = cloverleaf;
  my $localdir   = C:\\Documents and Settings\\mh-hl7;
  my $user   = ...;
  my $pass   = ...;
  my $data   = MHFM.txt.asc;
  my $ftplog = C:\\temp\\ftpxfer_to_OH.log;

  open (FTPLOG, $ftplog) or warn was unable to open FTPLOG $!;
  my $ftp = Net::FTP-new($remotehost, Debug = 10)
  or do {print FTPLOG Cannot connect to $remotehost $!;};
  $ftp-login($user,$pass) or do {print FTPLOG Login failed $!;};
  $ftp-binary();
  $ftp-cwd($remotedir);
  $ftp-get($data) or do {print FTPLOG Get data failed $!;};
  $ftp-quit;
}

#unlink $MHfile;

ftpme();

if ( -s $MHfile ) {
open (PASS, +$pass) or warn was unable to open FH $!;
for (;PASS;) {
print $_;
}
}
#else {
 #   print file $MHfile not present,\n;
  #  system (C:\\WINDOWS\\notepad.exe C:\\temp\\pass.txt);
#}

close (PASS) or warn was unable to close FH $!;

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams



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




using an system call for decryption

2005-12-29 Thread DBSMITH
All,

I am using gpg ( opensource encryption/decryption tool) to send files via
ftp to a remote site.
In my WIN32 Perl program I am trying to figure how I would do this
equivalent in Unix...

# cat gpgpass |gpg - - all the options newfile encryptedfile
The gpgpass is the password that will enable decryption to occur and it has
to be piped into the gpg binary as above.

Here is my program

#!/usr/bin/perl
use strict;
use warnings;
use diagnostics;
use Net::FTP;
require 5.8.0;
$ENV{PATH} = qq(C:\\Perl\\bin:C:\\Documents and
Settings\\mh-hl7:C:\\Program Files\\GNU\\GnuPG\\);

my $p   = qq(--passphrase-fd 0);
my $de  = qq(--decrypt);
my $outp= qq(--output);
my $ascfile = qq(MHFM.txt.asc);
my $gpgpass = q{};
my $MHfile0 = qq(C:\\temp\\derek);
#my $MHfile1 = qq(C:\\Documents and Settings\\mh-hl7\\MHFM.txt.asc);
my $MHfile1 = qq(C:\\Program Files\\DzSoft\\Perl
Editor\\Samples\\MHFM.txt.asc);
my $pass= qq(C:\\temp\\pass.txt);

sub ftpme {
  my $remotehost = 216.54.146.8;
  my $remotedir  = cloverleaf;
  my $localdir   = C:\\Documents and Settings\\mh-hl7;
  my $user   = ;
  my $pass   = .;
  my $data   = $ascfile;
  my $ftplog = C:\\temp\\ftpxfer_to_OH.log;

  open (FTPLOG, $ftplog) or warn was unable to open FTPLOG $!;
  my $ftp = Net::FTP-new($remotehost, Debug = 10)
  or do {print FTPLOG Cannot connect to $remotehost $!;};
  $ftp-login($user,$pass) or do {print FTPLOG Login failed $!;};
  $ftp-binary();
  $ftp-cwd($remotedir);
  $ftp-get($ascfile) or do {print FTPLOG Get data failed $!;};
  $ftp-quit;
}

unlink $MHfile0 or warn was unable to unlink old file $!;

ftpme();

rename($MHfile1,$MHfile0) or die was unable to cp file to $MHfile0
$!;
if ( -s $MHfile0 ) {
open (PASS, +$pass) or warn was unable to open FH $!;
for (;PASS;) {
$gpgpass = $_;
}

print $gpgpass | system (C:\\Program Files\GNU\GnuPG\gpg $p $de $outp
$MHfile0 $ascfile);

# I know the above will not work but this is what it should conceptually
look like.
}
#else {
 #   print file $ascfile not present,\n;
  #  system (C:\\WINDOWS\\notepad.exe C:\\temp\\pass.txt);
#}

close (PASS) or warn was unable to close FH $!;

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams



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




running a short perl script in a windows XP arena

2005-12-28 Thread DBSMITH
All,

Here is my script and it is outputting file is not present when it should
be outputting temp file is good and $MHfile is there\n;
Am I missing something since I am running this is a Windows env?
thank you,
derek


#!/usr/bin/perl

use strict;
use warnings;
require 5.8.0;
$ENV{PATH} = qq(C:\\Documents*\\mh-hl7:C:\\Perl\\bin);

my $p= qq(--passphrase-fd 0);
my $de= qw(--decrypt);
my $outp= qw(--output);
my $MHfile= qq(C:\\Documents*\\mh-hl7\\MHFM.*);
my $pass= qq(C:\\temp\\pass.txt);

# unlink qq(C:\\Documents*\\mh-hl7\\MHFM.*);

if ( -s $MHfile ) {
print temp file is good and $MHfile is there\n;
open (PASS, C:\\temp\\pass.txt);
for (;PASS;) {
print $_;
}
   }
   else {
print file not present\n;
#system (C:\\WINDOWS\\notepad.exe C:\\temp\\pass.txt);
}

close (PASS);

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams



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




RE: running a short perl script in a windows XP arena

2005-12-28 Thread DBSMITH
ok I will take that out  I reran it and still get the same error.  This
is not the problem.
Note: this is the correct way to do it within Unix.

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams




   
 Timothy Johnson 
 [EMAIL PROTECTED] 
 eckpoint.com  To 
   [EMAIL PROTECTED],   
 12/28/2005 05:06  beginners@perl.org
 PM cc 
   
   Subject 
   RE: running a short perl script in  
   a windows XP arena  
   
   
   
   
   
   





For starters, you aren't formatting your PATH variable correctly.  That
should be a semicolon before C:\\Perl.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 28, 2005 2:01 PM
To: beginners@perl.org
Subject: running a short perl script in a windows XP arena

All,

Here is my script and it is outputting file is not present when it
should
be outputting temp file is good and $MHfile is there\n;
Am I missing something since I am running this is a Windows env?
thank you,
derek


#!/usr/bin/perl

use strict;
use warnings;
require 5.8.0;
$ENV{PATH} = qq(C:\\Documents*\\mh-hl7:C:\\Perl\\bin);

my $p= qq(--passphrase-fd 0);
my $de= qw(--decrypt);
my $outp= qw(--output);
my $MHfile= qq(C:\\Documents*\\mh-hl7\\MHFM.*);
my $pass= qq(C:\\temp\\pass.txt);

# unlink qq(C:\\Documents*\\mh-hl7\\MHFM.*);

if ( -s $MHfile ) {
print temp file is good and $MHfile is there\n;
open (PASS, C:\\temp\\pass.txt);
for (;PASS;) {
print $_;
}
   }
   else {
print file not present\n;
#system (C:\\WINDOWS\\notepad.exe C:\\temp\\pass.txt);
}

close (PASS);

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams



--
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: use constant

2005-12-20 Thread DBSMITH
   
 John W. Krahn   
 [EMAIL PROTECTED] 
   To 
   Perl Beginners beginners@perl.org 
 12/19/2005 08:29   cc 
 PM
   Subject 
   Re: use constant
   
   
   
   
   
   







David Gilden wrote:
 Greetings,

Hello,

 I looked for documentation on 'use constant'  but it has eluded it
me.

 my $path =  `pwd`;
 use constant UPLOAD_DIR = /home/sites/site123/web/private/_data/;


 I want to get the Document Root at runtime and concatenate like such...


 my $path =  `pwd`;

You should probably use the Cwd module to do that.

 use constant UPLOAD_DIR = $path/_data/;

use Cwd;

my $path;
BEGIN { $path = cwd }

use constant UPLOAD_DIR = $path/_data/;



John
--
use Perl;
program
fulfillment

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





David,
although there are various ways to do what John stated, the use constant is
not a recomended
pragma according to the Oreilly book Perl Best Practices.
Rather Readonly is a better method b/c it can be interpolated.

use Readonly;
my $SCALER = 'value';

use Readonly;
my @ARRAY = 'value';

use Readonly;
 my %HASH = 'value';

for versions 5.8 and above

but for versions 5.6 and below

use Readonly::Scaler;
 my $SCALER = 'value';



Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams



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




rearranging a string

2005-11-21 Thread DBSMITH


In my situation I have a string like so:

my $string = '20050516';

and I want to rearrange it to look like: 05162005, so I tried:

my $newstring =
substr($string,0,8).substr($string,0,4).substr($string,8,0);


But my problem is: it's leaving 2005 in the beginning of the string to look
like 200505162005 when all I need is 05162005
Any ideas?
thx


Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
614-566-4145


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




Re: rearranging a string

2005-11-21 Thread DBSMITH
   
 Roberto   
 Etcheverry
 [EMAIL PROTECTED]  To 
 r[EMAIL PROTECTED]  
cc 
 11/21/2005 02:19  
 PMSubject 
   Re: rearranging a string
   
   
   
   
   
   







[EMAIL PROTECTED] wrote:

In my situation I have a string like so:

my $string = '20050516';

and I want to rearrange it to look like: 05162005, so I tried:

my $newstring =
substr($string,0,8).substr($string,0,4).substr($string,8,0);


But my problem is: it's leaving 2005 in the beginning of the string to
look
like 200505162005 when all I need is 05162005
Any ideas?


my $newstring = substr($string,4,4).substr($string,0,4);

Should do the trick...

thx


Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
614-566-4145




*
**

thanks Roberto!

that did work.
: )



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




Re: rearranging a string

2005-11-21 Thread DBSMITH
   
 [EMAIL PROTECTED] 
 h.com 
To 
 11/21/2005 02:33  beginners@perl.org  
 PM cc 
   
   Subject 
   Re: rearranging a string
   
   
   
   
   
   








 Roberto
 Etcheverry
 [EMAIL PROTECTED]  To
 r[EMAIL PROTECTED]
cc
 11/21/2005 02:19
 PMSubject
   Re: rearranging a string













[EMAIL PROTECTED] wrote:

In my situation I have a string like so:

my $string = '20050516';

and I want to rearrange it to look like: 05162005, so I tried:

my $newstring =
substr($string,0,8).substr($string,0,4).substr($string,8,0);


But my problem is: it's leaving 2005 in the beginning of the string to
look
like 200505162005 when all I need is 05162005
Any ideas?


my $newstring = substr($string,4,4).substr($string,0,4);

Should do the trick...

thx


Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
614-566-4145




*
**

thanks Roberto!

that did work.
: )



*
*

However, is one way more efficient that the other. To me Roberto's way
seems easier to read compared to Jeff's:

substr($string, 4, 2) . substr($string, 6, 2) . substr($string, 0, 4)





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




RE: implementing links on a system command output

2005-11-08 Thread DBSMITH
Nevermind on this problem, I fixed it but will be in touch.

thx.
derek

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams




   
 Derek 
 Smith/Staff/OhioH 
 ealth  To 
   beginners-cgi@perl.org  
 11/04/2005 03:08   cc 
 PM
   Subject 
   RE: implementing links on a system  
   command output(Document link: Derek 
   Bellner Smith)  
   
   
   
   
   
   






   
 Charles K.   
 Clarkson 
 [EMAIL PROTECTED]  To 
 .net beginners-cgi@perl.org
cc 
 10/21/2005 06:29  
 PMSubject 
   RE: implementing links on a system  
   command output  
   
   
   
   
   
   




[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:

: thx Charles, but your code is something I did knew (sic) already.
: I need to implement a link for each H string and I do not see
: this???

I assume by implement a link you mean that you want to
create an HTML ANCHOR tag for each H String. After re-reading your
original question on this thread I think you are looking for more
than just an anchor tag. You also need a method to retrieve
capacity data sets after a link has been followed.

Here is my solution.

my $url = 'capacity.pl?hstring';

my @links;
foreach my $h_string ( @h_strings ) {
push @links,
$q-a(
{ href= $url=$h_string },
$h_string
);
}

print
$q-ul(
$q-li( [EMAIL PROTECTED] ),
);


# in capacity.pl

#!/usr/bin/perl

use strict;
use warnings;

use CGI;

my $q = CGI-new();

my $h_string = $q-param( 'hstring' );

print
$q-header(),
$q-start_html( Capacity Data for $h_string ),
$q-p( capcity_data( $h_string ) ),
$q-end_html;

sub capcity_data {
my $h_string = shift;

#
# Do that thing you do to get capacity data and
#   deposit the result in $capacity_data.
#

return $capacity_data;
}

__END__



: So in the FH reference local *ARC;
: once its open, I can just reuse the reference right?  Does the
: FH have to still be open in order to reuse it?

I don'tknow what you are asking. For more info on why I
added local *ARC; read this article.

http://perl.plover.com/local.html#2_Localized_Filehandles



HTH,

Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328




Ok after a few mods, I got this working wherein each hstring is a link to
capacity.pl
which is supposed to run and gather the capacity data, but I am getting
page not found and in the URL it is displaying:

http://stkv440.ohnet/cgi-bin/=%20%20%20H01196

So it sounds like to me capacity.pl is not being opened and executed.
In the code:

my $url = 'capacity.pl?hstring';

my @links;
foreach my $h_string ( @h_strings ) {
push @links,
$q-a(
{ href= $url=$h_string },
$h_string
);
}

print
$q-ul(
$q-li( [EMAIL PROTECTED] ),

Re: uninitialized variable

2005-11-01 Thread DBSMITH
   
 Chris Devers  
 [EMAIL PROTECTED] 
 m To 
   Adedayo Adeyeye 
 11/01/2005 10:42  [EMAIL PROTECTED]
 AM cc 
   beginners-cgi@perl.org  
   Subject 
 Please respond to Re: uninitialized variable  
 [EMAIL PROTECTED] 
   l.org   
   
   
   
   







On Tue, 1 Nov 2005, Adedayo Adeyeye wrote:

 my $action = param('form_action');

Try setting a default value when 'form_action' isn't specified:

my $action = param('form_action') or '';

Or set it to 0, or 'do nothing' or undef, or whatever is appropriate.


--
Chris Devers

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





from Perl Best Practices


use

my $action = param('form_action') | | q{ }


instead of

or ' '

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams



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




Re: uninitialized variable

2005-11-01 Thread DBSMITH
   
 Chris Devers  
 [EMAIL PROTECTED] 
 m To 
   [EMAIL PROTECTED]  
 11/01/2005 11:10   cc 
 AMbeginners-cgi@perl.org  
   Subject 
   Re: uninitialized variable  
 Please respond to 
 [EMAIL PROTECTED] 
   l.org   
   
   
   







On Tue, 1 Nov 2005 [EMAIL PROTECTED] wrote:

 from Perl Best Practices

 use

my $action = param('form_action') | | q{ }

 instead of

or ' '


Good catch. Yes, that's clearer than simple apostrophes.

However, you probably didn't really mean | | over ||, right ? :-)

I still think 'or' is clearer than '||' for this kind of thing, but if
PBP had a different rationale I can't remember what it was...


--
Chris Devers
*


yes dudegood catch as well . aka || and {}
Its a lotus notes thing... : (


Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
614-566-4145


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




RE: implementing links on a system command output

2005-10-21 Thread DBSMITH
   
 Charles K.   
 Clarkson 
 [EMAIL PROTECTED]  To 
 .net beginners-cgi@perl.org
cc 
 10/20/2005 07:35  
 PMSubject 
   RE: implementing links on a system  
   command output  
   
   
   
   
   
   







[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:

: ok here is what I am trying to do. In the atached doc it shows
: output from my perl cgi program ...

You sent this as a MS Word document. When I open it, Word
converts it to a word web view and when I view the code I get a
Word trashed html file listing. Can you send this as a raw text
file instead? The Word format is pretty useless.

excerpt

 html xmlns:v=urn:schemas-microsoft-com:vml
 xmlns:o=urn:schemas-microsoft-com:office:office
 xmlns:w=urn:schemas-microsoft-com:office:word
 xmlns:st1=urn:schemas-microsoft-com:office:smarttags
 xmlns=http://www.w3.org/TR/REC-html40;

 head
 meta http-equiv=Content-Type content=text/html; charset=windows-1252
 link rel=Original-File href=file:///FOOBAR%20on%20links.doc
 meta name=ProgId content=Word.Document
 meta name=Generator content=Microsoft Word 10
 meta name=Originator content=Microsoft Word 10
 link rel=File-List href=FOOBAR%20on%20links_files/filelist.xml
 link rel=Edit-Time-Data href=FOOBAR%20on%20links_files/editdata.mso
 !--[if !mso]
 style
 v\:* {behavior:url(#default#VML);}
 o\:*
{behavior:url(#default#VML);}
 w\:* {behavior:url(#default#VML);}
 .shape
{behavior:url(#default#VML);}

/excerpt

Not what I think really came out
of your CGI script.



[snip]


: sf.H02047 capacity: 189.1G space: 117.7G.

[snip]


:
Is this more clearer?

No. I still don't have more than the above sample
of what an
H string is. You also haven't shown source code that allows me to
answer your need, and you have not restated the problem you are
having. I am
not going back into the thread to find out what your
problem is.

Let's go
back to the beginning.

1 - Show me what is you are starting with. Use a
large sample.
Not just one input. Be that a file or a list or
whatever.

2 - Show me the results you expect the script to display.

3
- Show me what you have got for code so for. Edit out any
sensitive
items like passwords and things.

Don't send these back as anything but
raw text files. Do not
send Word documents. I'd like to help but you are
giving much of
the wrong information. Lean toward giving us too much
information
rather than too little.


HTH,

Charles K. Clarkson
-- 
Mobile Homes
Specialist
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
**
**

ok beginning it is..

I am starting with a view from a radio button that displays how much space
is remaining in each pool labeled as fs_heartlab.1 and fs_heartlab.2.
Under these headings are H strings and from each H string I am trying to
set-up a link to push me to another page that displays a data set as such:
sf.H02047 capacity: 189.1G space: 117.7G.
The difficulty is that $_ is an entire block of data that includes more
than just H strings and therefore I cannot link all of $_ which is why I
placed just the H strings
from $_ in an array.  From this array, I was thinking of traversing
through, running the command to get the capacity data.

thx for the persistence!




HERE IS $_


fs_heartlab.1
 sort:path
 media: sg
 Volumes:
   H01192
   H01193
   H01195
   H01196
   H01197
 Total space available:  111.3G

fs_heartlab.2
 sort:path
 media: sf
 Volumes:
   H02047
   H02048
   H02051
   H02052
   H02000
   H02039
   H02040
   H02041
 Total space available:  527.8G

FUTURE 

RE: implementing links on a system command output

2005-10-21 Thread DBSMITH
   
 Charles K.   
 Clarkson 
 [EMAIL PROTECTED]  To 
 .net beginners-cgi@perl.org
cc 
 10/21/2005 12:24  
 PMSubject 
   RE: implementing links on a system  
   command output  
   
   
   
   
   
   







[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:

: The difficulty is that $_ is an entire block of data that
: includes more than just H strings and therefore I cannot link
: all of $_ which is why I placed just the H strings from $_ in an
: array.  From this array, I was thinking of traversing
: through, running the command to get the capacity data.

 Here's what I am gleaming from your words.

 When you say $_ you are referring to this part of the script:

 open (ARC, archiver -v |) or error();
 foreach (ARC)
 {

 archiver -v | returns this.

fs_heartlab.1
 sort:path
 media: sg
 Volumes:
   H01192
   H01193
   H01195
   H01196
   H01197
 Total space available:  111.3G

fs_heartlab.2
 sort:path
 media: sf
 Volumes:
   H02047
   H02048
   H02051
   H02052
   H02000
   H02039
   H02040
   H02041
 Total space available:  527.8G

 So, as a test case, we can use this script. DATA is the same
as ARC above, but now everyone on this list can play with the
code. I use 'while' instead of 'foreach' because it is the more
common idiom in this situation.

#!/usr/bin/perl

use strict;
use warnings;

while ( DATA ) {
 # do something
}

__END__

fs_heartlab.1
 sort:path
 media: sg
 Volumes:
   H01192
   H01193
   H01195
   H01196
   H01197
 Total space available:  111.3G

fs_heartlab.2
 sort:path
 media: sf
 Volumes:
   H02047
   H02048
   H02051
   H02052
   H02000
   H02039
   H02040
   H02041
 Total space available:  527.8G


 Now, if I am not mistaken your task is to strip only the
H strings from this list and place it into an array. Since I am
mentally unable to name an array variable with a name containing
the word array, I will be using the name @h_strings.

#!/usr/bin/perl

use strict;
use warnings;

my @h_strings;
while ( DATA ) {
 chomp;
 push @h_strings, $1 if /\s*(H\d{5})/i;
}

print $_\n foreach @h_strings;

__END__

fs_heartlab.1
 sort:path
 media: sg
 Volumes:
   H01192
   H01193
   H01195
   H01196
   H01197
 Total space available:  111.3G

fs_heartlab.2
 sort:path
 media: sf
 Volumes:
   H02047
   H02048
   H02051
   H02052
   H02000
   H02039
   H02040
   H02041
 Total space available:  527.8G

 Now @h_strings contains this. Which I believe provides you
with the array you needed to run your command.

H01192
H01193
H01195
H01196
H01197
H02047
H02048
H02051
H02052
H02000
H02039
H02040
H02041

 To step through the array, you could use foreach.

foreach my $h_string ( @h_strings ) {
 # Do something with $h_string.
}


 If you want to do it all in one step, this would work.

#!/usr/bin/perl

use strict;
use warnings;

while ( DATA ) {
 chomp;
 next unless /\s*(H\d{5})/i;

 my $h_string = $1;
 # Do something with $h_string.
}

__END__

 To translate that back to your subroutine, we would do this.

sub viewhrtlab {

 # Don't clobber ARC if it is already open somewhere else.
 local *ARC;

 open (ARC, archiver -v |) or error();

 while ( ARC ) {
 chomp;
 next unless /\s*(H\d{5})/i;

 my $h_string = $1;

 # Do something with $h_string.
 }
}

HTH,


Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328
**
**

thx Charles, but your code is something I did knew already.
I need to implement a link for each H string and I do not see this???  I
think we are part way there as in producing the capacity data sets from the
array, 

Re: implementing links on a system command output

2005-10-18 Thread DBSMITH
   
 Greg Jetter   
 [EMAIL PROTECTED] 
 n.com To 
   beginners-cgi@perl.org  
 10/14/2005 02:46   cc 
 PM
   Subject 
   Re: implementing links on a system  
   command output  
   
   
   
   
   
   







On Friday October 14 2005 12:07 pm, [EMAIL PROTECTED] wrote:
  Jay Savage
  [EMAIL PROTECTED]
  l.com
To
beginners-cgi@perl.org
  10/14/2005 11:56
cc
  AM

Subject
Re: implementing links on a system
command output

 On 10/14/05, Chris Devers [EMAIL PROTECTED] wrote:
  On Fri, 14 Oct 2005 [EMAIL PROTECTED] wrote:
   I have written a CGI Perl program that allows my users to view
   relevant data.
  
   The data is produced by a Unix application command and I have told it
   to write to a intranet page that looks like:
 
  What it looks like is irrelevant. The raw HTML is a little bit
relevant,
  but the really relevant thing is the data that gets sent to the script
  and the results that are expected to be returned from the script.
 
   What I want to do now is create a link using CGI Perl for each H
   string that will pull a different data set either on a new page or on
   the same page embedded.
  
   Originally I just created another radio button for the new data set,
   but there will be 6 different views (6 different strings) and I
   already have 7 buttons (minus the Tape-Capacity button) and I do not
   want to button out myself or the users.
  
   I looked in the CGI Programming with Perl and saw an entry in there
on
   page 269 referencing access.conf and in access.conf you enter a line
   with
  
   Action Tracker /cgi/track.cgi
  
   Can anyone help?
 
  I'm sorry, I'm confused by the question.
 
  You seem to want help organizing how data is presented to and retrieved
  from the user of your web application, but then you're asking a CGI
list
  how to go about doing advanced Apache web server configuration. How was
  the access.conf suggestion supposed to help solve this problem?
 
  IF the answer to your problem is to start mucking around with Apache
  directives -- and so far I'm not convinced that it is -- then putting
  those directives in access.conf is outdated advice anyway. Modern
Apache
  administration tends to have people put everything in httpd.conf so
that
  there's one file to look in; some people break things into separate
conf
  files that httpd.conf includes, but this generally isn't how it's done
  by people just getting started with Apache administration now.
 
  In any case, it isn't clear to me how this was supposed to solve your
  problem to begin with. What were you hoping would happen if you changed
  the behavior of /cgi/track.cgi in Apache? I think you're better off
just
  concentrating on your HTML and CGI code for now, and leave mucking with
  the web server for later.
 
  Reduce the problem to a flow of desired inputs and outputs. The inputs
  are generally going to be forms in plain HTML documents or as generated
  by the output from CGI scripts; the outputs will generally be generated
  from CGI scripts, though in some cases could be static HTML, too. You
  may want to sketch things out on paper rather than just blindly start
  coding things. If some part of the input system is doing too much or is
  too confusing for users or maintainers, then break it apart as needed.
 
  You seem to be asking general systems design questions without giving
  enough material to clarify what the system is doing now or how it is
  supposed to be working differently in the future. This is only
  tangentally a CGI question; your first priority here seems to be to
sort
  out exactly how this is all supposed to be interoperating in the first
  place. Once you have a clearer sense of that, implementing the specific
  components of the system should get easier for you.
 
 
  --
  Chris Devers

 And at the risk of 

Re: implementing links on a system command output

2005-10-14 Thread DBSMITH
   
 Derek 
 Smith/Staff/OhioH 
 ealth  To 
   beginners-cgi@perl.org
 10/12/2005 05:52   cc 
 PM
   Subject 
   implementing links on a system  
   command output  
   
   
   
   
   
   






I have written a CGI Perl program that allows my users to view relevant
data.
The data is produced by a Unix application command and I have told it to
write to a intranet page that looks like:

|--|
| ( )  |
|--|All-Clients
|--|
| ( )  |
|--|Backup-Tapes
|--|
| ( )  |
|--|PACS-Fuji
|--|
| (*)  |
|--|Heartlab
|--|
| ( )  |
|--|StreamLine-Health
|--|
| ( )  |
|--|Archiver-Status
|--|
| ( )  |
|--|Tape-Drive-Status
|--|
| ( )  |
|--|Tape-Capacity



fs_heartlab.1


sort:path


media: sg


Volumes:


H01190


H01191


H01192


H01193


Total space available: 74.0G





What I want to do now is create a link using CGI Perl for each H string
that will pull a different data set either on a new page or on the same
page embedded.
Originally I just created another radio button for the new data set, but
there will be 6 different views (6 different  strings) and I already have 7
buttons (minus the Tape-Capacity button) and I do not want to button out
myself or the users.

I looked in the CGI Programming with Perl and saw an entry in there on page
269 referencing access.conf and in access.conf you enter a line with

Action Tracker /cgi/track.cgi

Can anyone help?

thx
derek

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams


***



Can anyone respond please 



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




Re: implementing links on a system command output

2005-10-14 Thread DBSMITH
   
 Jay Savage
 [EMAIL PROTECTED] 
 l.com To 
   beginners-cgi@perl.org  
 10/14/2005 11:56   cc 
 AM
   Subject 
   Re: implementing links on a system  
   command output  
   
   
   
   
   
   







On 10/14/05, Chris Devers [EMAIL PROTECTED] wrote:
 On Fri, 14 Oct 2005 [EMAIL PROTECTED] wrote:

  I have written a CGI Perl program that allows my users to view
  relevant data.
 
  The data is produced by a Unix application command and I have told it
  to write to a intranet page that looks like:

 What it looks like is irrelevant. The raw HTML is a little bit relevant,
 but the really relevant thing is the data that gets sent to the script
 and the results that are expected to be returned from the script.

  What I want to do now is create a link using CGI Perl for each H
  string that will pull a different data set either on a new page or on
  the same page embedded.
 
  Originally I just created another radio button for the new data set,
  but there will be 6 different views (6 different strings) and I
  already have 7 buttons (minus the Tape-Capacity button) and I do not
  want to button out myself or the users.
 
  I looked in the CGI Programming with Perl and saw an entry in there on
  page 269 referencing access.conf and in access.conf you enter a line
  with
 
  Action Tracker /cgi/track.cgi
 
  Can anyone help?

 I'm sorry, I'm confused by the question.

 You seem to want help organizing how data is presented to and retrieved
 from the user of your web application, but then you're asking a CGI list
 how to go about doing advanced Apache web server configuration. How was
 the access.conf suggestion supposed to help solve this problem?

 IF the answer to your problem is to start mucking around with Apache
 directives -- and so far I'm not convinced that it is -- then putting
 those directives in access.conf is outdated advice anyway. Modern Apache
 administration tends to have people put everything in httpd.conf so that
 there's one file to look in; some people break things into separate conf
 files that httpd.conf includes, but this generally isn't how it's done
 by people just getting started with Apache administration now.

 In any case, it isn't clear to me how this was supposed to solve your
 problem to begin with. What were you hoping would happen if you changed
 the behavior of /cgi/track.cgi in Apache? I think you're better off just
 concentrating on your HTML and CGI code for now, and leave mucking with
 the web server for later.

 Reduce the problem to a flow of desired inputs and outputs. The inputs
 are generally going to be forms in plain HTML documents or as generated
 by the output from CGI scripts; the outputs will generally be generated
 from CGI scripts, though in some cases could be static HTML, too. You
 may want to sketch things out on paper rather than just blindly start
 coding things. If some part of the input system is doing too much or is
 too confusing for users or maintainers, then break it apart as needed.

 You seem to be asking general systems design questions without giving
 enough material to clarify what the system is doing now or how it is
 supposed to be working differently in the future. This is only
 tangentally a CGI question; your first priority here seems to be to sort
 out exactly how this is all supposed to be interoperating in the first
 place. Once you have a clearer sense of that, implementing the specific
 components of the system should get easier for you.


 --
 Chris Devers


And at the risk of sounding more Chris than Chris on this thread:

What have you tried?
Where did it go wrong?
Where's your code?

I have to say, I'm not getting this either. Is your question about
getting CGI.pm to generate dynamic content based on system command
output? Or is your question simply how to declutter a page full of
radio buttons? Or is your question something else entirely?

Whichever it is, giving some specific code you're having trouble with
will get you a 

Re: implementing links on a system command output

2005-10-14 Thread DBSMITH
   
 Greg Jetter   
 [EMAIL PROTECTED] 
 n.com To 
   beginners-cgi@perl.org  
 10/14/2005 02:46   cc 
 PM
   Subject 
   Re: implementing links on a system  
   command output  
   
   
   
   
   
   







On Friday October 14 2005 12:07 pm, [EMAIL PROTECTED] wrote:
  Jay Savage
  [EMAIL PROTECTED]
  l.com
To
beginners-cgi@perl.org
  10/14/2005 11:56
cc
  AM

Subject
Re: implementing links on a system
command output

 On 10/14/05, Chris Devers [EMAIL PROTECTED] wrote:
  On Fri, 14 Oct 2005 [EMAIL PROTECTED] wrote:
   I have written a CGI Perl program that allows my users to view
   relevant data.
  
   The data is produced by a Unix application command and I have told it
   to write to a intranet page that looks like:
 
  What it looks like is irrelevant. The raw HTML is a little bit
relevant,
  but the really relevant thing is the data that gets sent to the script
  and the results that are expected to be returned from the script.
 
   What I want to do now is create a link using CGI Perl for each H
   string that will pull a different data set either on a new page or on
   the same page embedded.
  
   Originally I just created another radio button for the new data set,
   but there will be 6 different views (6 different strings) and I
   already have 7 buttons (minus the Tape-Capacity button) and I do not
   want to button out myself or the users.
  
   I looked in the CGI Programming with Perl and saw an entry in there
on
   page 269 referencing access.conf and in access.conf you enter a line
   with
  
   Action Tracker /cgi/track.cgi
  
   Can anyone help?
 
  I'm sorry, I'm confused by the question.
 
  You seem to want help organizing how data is presented to and retrieved
  from the user of your web application, but then you're asking a CGI
list
  how to go about doing advanced Apache web server configuration. How was
  the access.conf suggestion supposed to help solve this problem?
 
  IF the answer to your problem is to start mucking around with Apache
  directives -- and so far I'm not convinced that it is -- then putting
  those directives in access.conf is outdated advice anyway. Modern
Apache
  administration tends to have people put everything in httpd.conf so
that
  there's one file to look in; some people break things into separate
conf
  files that httpd.conf includes, but this generally isn't how it's done
  by people just getting started with Apache administration now.
 
  In any case, it isn't clear to me how this was supposed to solve your
  problem to begin with. What were you hoping would happen if you changed
  the behavior of /cgi/track.cgi in Apache? I think you're better off
just
  concentrating on your HTML and CGI code for now, and leave mucking with
  the web server for later.
 
  Reduce the problem to a flow of desired inputs and outputs. The inputs
  are generally going to be forms in plain HTML documents or as generated
  by the output from CGI scripts; the outputs will generally be generated
  from CGI scripts, though in some cases could be static HTML, too. You
  may want to sketch things out on paper rather than just blindly start
  coding things. If some part of the input system is doing too much or is
  too confusing for users or maintainers, then break it apart as needed.
 
  You seem to be asking general systems design questions without giving
  enough material to clarify what the system is doing now or how it is
  supposed to be working differently in the future. This is only
  tangentally a CGI question; your first priority here seems to be to
sort
  out exactly how this is all supposed to be interoperating in the first
  place. Once you have a clearer sense of that, implementing the specific
  components of the system should get easier for you.
 
 
  --
  Chris Devers

 And at the risk of 

implementing links on a system command output

2005-10-12 Thread DBSMITH
I have written a CGI Perl program that allows my users to view relevant
data.
The data is produced by a Unix application command and I have told it to
write to a intranet page that looks like:

|--|
| ( )  |
|--|All-Clients
|--|
| ( )  |
|--|Backup-Tapes
|--|
| ( )  |
|--|PACS-Fuji
|--|
| (*)  |
|--|Heartlab
|--|
| ( )  |
|--|StreamLine-Health
|--|
| ( )  |
|--|Archiver-Status
|--|
| ( )  |
|--|Tape-Drive-Status
|--|
| ( )  |
|--|Tape-Capacity



fs_heartlab.1


sort:path


media: sg


Volumes:


H01190


H01191


H01192


H01193


Total space available: 74.0G





What I want to do now is create a link using CGI Perl for each H string
that will pull a different data set either on a new page or on the same
page embedded.
Originally I just created another radio button for the new data set, but
there will be 6 different views (6 different  strings) and I already have 7
buttons (minus the Tape-Capacity button) and I do not want to button out
myself or the users.

I looked in the CGI Programming with Perl and saw an entry in there on page
269 referencing access.conf and in access.conf you enter a line with

Action Tracker /cgi/track.cgi

Can anyone help?

thx
derek

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams



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




compiling Storable in order to use Proc::ProcessTable

2005-09-29 Thread DBSMITH
As I am attempting to compile this module I am getting many errors on an
HPUX 11.11 64 bit machine.
Any help please ?

(See attached file: log)
thank you,


Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams


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


RE: Use of uninitialized value

2005-09-15 Thread DBSMITH
   
 Charles K.   
 Clarkson 
 [EMAIL PROTECTED]  To 
 .net beginners-cgi@perl.org
cc 
 09/14/2005 08:57  
 PMSubject 
   RE: Use of uninitialized value  
   
   
   
   
   
   







[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:

: it is on line 207...thx!
: Use of uninitialized value in string eq at line 207

: (See attached file: ASM_monitor.pl)


Are you certain the version you sent is the version
on the server?


This does not produce an error. (It is from the version
you sent.)

#!/usr/bin/perl

use strict;
use warnings;

use CGI qw(:standard), (-unique_headers);

my $q = CGI-new();

my $which_import = $q-param('action') || '';

if ($which_import eq 'Import STKvol') {
print foo\n;
}

__END__


This *does* produce an error.

#!/usr/bin/perl

use strict;
use warnings;

use CGI qw(:standard), (-unique_headers);

my $q = CGI-new();

my $which_import = $q-param('action');

if ($which_import eq 'Import STKvol') {
print foo\n;
}

__END__


HTH,

Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328
*

you must be right b/c I have not seen any errors in
/var/apache/logs/error_log since yesterday.
If I do see anymore I will continue this thread.

thanks
derek




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




RE: Use of uninitialized value

2005-09-14 Thread DBSMITH
what do you mean I cant?  It is logically working!  Is this is
recommedation for more readibility and thats it?  Or is this Perl best
practice thingy?

thank you!


Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams




   
 Charles K.   
 Clarkson 
 [EMAIL PROTECTED]  To 
 .net beginners-cgi@perl.org
cc 
 09/13/2005 02:02  
 PMSubject 
   RE: Use of uninitialized value  
   
   
   
   
   
   




[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] wrote:

: I'd rather send the whole thing b/c I also would like a critique
: as well. Here she is!

First glaring item: you cannot nest subroutines. To perl, the
following are equivalent.


===
print blah;
if ( $which_radio_button eq 'All-Clients' ) {
viewall();

sub viewall {
# do something;
}

} elsif ( $which_radio_button eq 'Backup-Tapes' ) {
viewbkups();
sub viewbkups {
# do something else;
}
}


===

print blah;
if ( $which_radio_button eq 'All-Clients' ) {
viewall();

} elsif ( $which_radio_button eq 'Backup-Tapes' ) {
viewbkups();
}

sub viewall {
# do something;
}

sub viewbkups {
# do something else;
}

===

So there's no advantage to placing the subs in line and taking
them out makes your code more readable.


HTH,

Charles K. Clarkson
--
Mobile Homes Specialist
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





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




RE: Use of uninitialized value

2005-09-13 Thread DBSMITH
   
 Charles K.   
 Clarkson 
 [EMAIL PROTECTED]  To 
 .net beginners@perl.org
cc 
 09/13/2005 01:19  
 PMSubject 
   RE: Use of uninitialized value  
   
   
   
   
   
   







[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:

: do you want me to seed the entire program. it is over 700
: lines? it on lines 246 for eaxmple.  And anywhere I assign a
: variable to a q-param construct such as $which_import and
: $which_radio_button.

You could send us a working example which produces the same
error. Snip out the irrelevant parts of your script. There is a
chance that you will find the error as you write the example code.
That's happened to me more than once. :)


HTH,

Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328

*

I'd rather send the whole thing b/c I also would like a critique as well.
Here she is!

thank you

derek


(See attached file: ASM_monitor.pl)


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


RE: Use of uninitialized value

2005-09-13 Thread DBSMITH
do you want me to seed the entire program. it is over 700 lines?
it on lines 246 for eaxmple.  And anywhere I assign a variable to a
q-param construct such as $which_import and $which_radio_button.

thank you so much!


Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams




   
 Jeff 'japhy'  
 Pinyan
 [EMAIL PROTECTED]  To 
 rg   [EMAIL PROTECTED]  
cc 
 09/12/2005 02:47  Charles K. Clarkson   
 PM[EMAIL PROTECTED], 
   beginners@perl.org  
   Subject 
   RE: Use of uninitialized value  
   
   
   
   
   
   




On Sep 12, [EMAIL PROTECTED] said:

 I have tried this and I am still getting a similiar error.
 Here is my perl-cgi code:

WHICH line is the uninitialized value warning coming from?

 my $which_import = $q-param('action') || '';

 foreach my $scalar (@imports)
 {
  if ($which_import eq 'Import H9940')
  {
 while (SAM)
 {
  if (/(?ig)$scalar/)

You can't put 'g' inside the (?...) construct of a regex.  That should be
written as

   /(?i)$scalar/g

or just

   /$scalar/ig

But I'm not even sure the /g is necessary...

--
Jeff japhy Pinyan%  How can we ever be the sold short or
RPI Acacia Brother #734%  the cheated, we who for every service
http://www.perlmonks.org/  %  have long ago been overpaid?
http://princeton.pm.org/   %-- Meister Eckhart



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




RE: Use of uninitialized value

2005-09-13 Thread DBSMITH
   
 Charles K.   
 Clarkson 
 [EMAIL PROTECTED]  To 
 .net beginners@perl.org
cc 
 09/13/2005 01:19  
 PMSubject 
   RE: Use of uninitialized value  
   
   
   
   
   
   







[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:

: do you want me to seed the entire program. it is over 700
: lines? it on lines 246 for eaxmple.  And anywhere I assign a
: variable to a q-param construct such as $which_import and
: $which_radio_button.

You could send us a working example which produces the same
error. Snip out the irrelevant parts of your script. There is a
chance that you will find the error as you write the example code.
That's happened to me more than once. :)


HTH,

Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328

*

I'd rather send the whole thing b/c I also would like a critique as well.
Here she is!

thank you

derek


(See attached file: ASM_monitor.pl)


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


perl 5.6.1debug version 1.07

2005-08-19 Thread DBSMITH
All,

I am having some weird system call return codes and I am hoping for some
help.
when I run in debug mode a system command I get this error:


here is my debugger code

perl -dT foo

use strict;
use warnings;

$ENV{PATH} = qq (/blah blah/);
system (import -v H02046 900) or die $!;

END DEBUG MODE


syntax error at (eval 22) [/usr/perl5/5.6.1/lib/perl5db.pl:1521 ]  line 2 ,
at EOF

Any ideas?  The command works outside of debug mode, but not in debug mode.
In production I am running the snippet of code in a CGI program, and the
error I get from CGI::Carp is

Interrupted system call and


Can't locate object method header via package Interrupted system call
(perhaps you forgot to load Interrupted system call?) at
/var/apache/cgi-bin/ASM_monitor.pl line 30.

at line 30 is


sub error
{
my ($q, $error_messg) = @_;
print   $q-header( -type= text/html ), ## Line 30
here
$q-start_html(ASM CGI Page Error),
$q-h1(ASM CGI Page Error),
$q-p(The following Error has occurred when
retrieving ASM data via CGI to your browser:),
$q-p($q-i($error_messg) ),
$q-end_html;
exit;
}







Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams



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




perl 5.6.1debug version 1.07

2005-08-19 Thread DBSMITH
All,

I am having some weird system call return codes and I am hoping for some
help.
when I run in debug mode a system command I get this error:


here is my debugger code

perl -dT foo

use strict;
use warnings;

$ENV{PATH} = qq (/blah blah/);
system (import -v H02046 900) or die $!;

END DEBUG MODE


syntax error at (eval 22) [/usr/perl5/5.6.1/lib/perl5db.pl:1521 ]  line 2 ,
at EOF

Any ideas?  The command works outside of debug mode, but not in debug mode.
In production I am running the snippet of code in a CGI program, and the
error I get from CGI::Carp is

Interrupted system call and


Can't locate object method header via package Interrupted system call
(perhaps you forgot to load Interrupted system call?) at
/var/apache/cgi-bin/ASM_monitor.pl line 30.

at line 30 is


sub error
{
my ($q, $error_messg) = @_;
print   $q-header( -type= text/html ), ## Line 30
here
$q-start_html(ASM CGI Page Error),
$q-h1(ASM CGI Page Error),
$q-p(The following Error has occurred when
retrieving ASM data via CGI to your browser:),
$q-p($q-i($error_messg) ),
$q-end_html;
exit;
}







Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams



-- 
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 cgi scrolling list within a forloop

2005-08-12 Thread DBSMITH
   
 zentara   
 [EMAIL PROTECTED] 
 am.netTo 
 Sent by:  beginners-cgi@perl.org  
 [EMAIL PROTECTED]  cc 
 ooper.com 
   Subject 
   Re: perl cgi scrolling list within  
 08/12/2005 09:13  a forloop   
 AM
   
   
   
   
   







On Wed, 10 Aug 2005 13:32:39 -0400, [EMAIL PROTECTED] wrote:


   foreach (@ARRAY With H strings)
   {
  print ('htapes99',[$_],5,'true',my %attributes);
}

It prints to the intranet with the scroll lisyt but it is not printing the
actual H strings. Instead it is printing the array structure lie so:


ARRAY(0x16bd90)5trueARRAY(0x16f974)5trueARRAY(0x16bcf4)5trueARRAY(0x16bd90)5trueARRAY(0x16f9)


All you need to do is dereference them and do whatever you want with
them.

  foreach my $aref (@ARRAY With H strings)
  {
   my @arr = @$aref;
   print ('htapes99',  @arr   ,5,'true',my %attributes);
   }

Of course you will probably want to make a nested loop
to loop thru @arr instead of just printing it.



--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html


+++

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams




I was able to get it working without a foreach loop by using:

my @H99tapes = ( ## .. ##);

print $q-scrolling_list(-name='imported_tapes',
-values=[EMAIL PROTECTED],
   -default=[$H99tapes[0]],
-multiple=1,
-override=1,
-size=10),br;
print   $q-submit(-name='action',-value='Delete'),
$q-submit(-name='action',-value='Add');


##--## Recover the new tape(s) from the Scroll List parameter
'imported_tapes' ##--##

my @imports = param('imported_tapes');


My original problem was I wanted to use splice to dynamically re-populate
an array or hash based off of what the user selected through this scroll
list, but could not get this to work.

Here s the pseucdode I am using:

as H numbers are submitted by user from a scroll list
remove selected elements from @H99tapes
repopulate new list into @UserH99tapes
print @UserH99tapes

OR

as H numbers are submitted by user from a scroll list
remove selected elements from @H99tapes
repush remaining elements into @H99tapes
print @H99tapes

Any ideas to help me with this problem?
basically dynamically splicing an array or hash.  Note each element
contains unique data, H[0-1000] strings for example.


##--## BEGIN IMPORT
##--##
##--## AS H NUMBERS ARE SELECTED, REMOVE
SUBMITTED ELEMENTS FROM USER ARRAY ##--##
##--## REPOPULATE LIST INTO NEW ARRAY,
PRINT NEW ARRAY. ##--##

my @tape_imports_to_del =
$q-param(htapes99); ##--## SELECTED BY USER ##--#
my $tape_count = scalar
@tape_imports_to_del;  ##--## COUNT##--##

foreach (@tape_imports)
{
   splice
(@H99tapes,0,$tape_count,@H99tapes)
}


thank you,

derek


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




popping, shifting or splicing an array???

2005-08-09 Thread DBSMITH


Hello ...

I am trying to figure out, which operator to use; pop, shift or splice.
My goal is,  as an option is selected from user input,  pop or splice or
shift elements off ( those selected from user input ) and repopulate array
with remaining elements.

Scenarios:

as numbers are selected
remove elements from array A
repopulate list with what is remaining into array A
print array A

as numbers are selected
remove elements from array A
repopulate remaining numbers in to array B
print array B

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

@ArrayA=(0 .. 1000);
print @array;  ## User now sees selection list.  This could be replaced
with splice or shift or pop
foreach (splice @ArrayA, @numbers to remove, scalar of @numbers to remove,
@ArrayA)
{
  print $_;
}

# Array A now has 05-1000

OR

@ArrayA=(0 .. 1000);
print @array;  ## User now sees selection list.  This could be replace with
a loop that is popping, shifting or splicing
foreach (@ArrayA)
{
  shift @number to remove;
}
print @ArrayA

# Array A now has 05-1000

OR

@ArrayA=(0 .. 1000);
print @array;  ## User now sees selection list.  This could be replaced
with splice or shift or pop
foreach (splice @ArrayA, @numbers to remove, scalar of @numbers to remove,
@ArrayB)
{
  print $_;
}

#ArrayB now has 05 - 1000


thank you,

derek


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




Re: popping, shifting or splicing an array???

2005-08-09 Thread DBSMITH
   
 Offer Kaye
 [EMAIL PROTECTED] 
 .com  To 
   Perl Beginners beginners@perl.org 
 08/09/2005 01:31   cc 
 PM
   Subject 
   Re: popping, shifting or splicing   
   an array??? 
   
   
   
   
   
   







On 8/9/05, DBSMITH wrote:

 Hello ...

 I am trying to figure out, which operator to use; pop, shift or splice.
 My goal is,  as an option is selected from user input,  pop or splice or
 shift elements off ( those selected from user input ) and repopulate
array
 with remaining elements.


Hi,
First of all, I don't grok your splice examples. According to
'perldoc -f splice' (http://perldoc.perl.org/functions/splice.html),
the second argument to splice should be an offset - i.e. a number. So
@numbers to remove will be interpreted in scalar context, and the
offeset into @ArrayA will be the lengh of the list of numbers to
remove. Is that what you wanted?

A second point is that you use shift inside a for loop. That's *BAD*:
If any part of LIST is an array, foreach  will get very confused if
you add or remove elements within the loop body, for example with
splice. So don't do that. (perldoc perlsyn)

pop removes that last value of an array (shortning the array).
shift also shortens the array, but by removing the first element.
Which one you want to use depends on what your array looks like and
what you want to do. In any case you don't need to repopulate the
array - both pop and shift change the array itself. Finally, note that
splice can 'emulate' both operators - see the splice perldoc page
for examples.

HTH,
--
Offer Kaye



++

thanks for the reply.. (*)

I probably need splice as I will need to delete multiple elements at the
same time
based on user selections.

(1..1000)
user selects 1..5
splice 1..5, returning new or existing array with 6..1000 as new elements.
Note each element contains unique data, etc. H#

ok so my new for loop would be

foreach (splice @TEMPARRAY,scalar of @TEMPARRAY,scalar of @TEMPARRAY,)
{

}

I guess I am missing how Length and Offset differ in this context?






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




Re: reg exp using \G

2005-08-03 Thread DBSMITH
   
 Jay Savage
 [EMAIL PROTECTED] 
 l.com To 
   [EMAIL PROTECTED]
 08/02/2005 05:43  [EMAIL PROTECTED], beginners 
 PMperl beginners@perl.org   
cc 
   
 Please respond to Subject 
Jay Savage Re: reg exp using \G
 [EMAIL PROTECTED] 
  l.com   
   
   
   
   







Please don't top post. I think you've been asked this before.


On 8/2/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 ok I understand now...thanks, but I tried it and it is still stopping at
 original1.1
 I then modified it to print YE if ($1) but never saw YE in
STDOUT.


Tha's because as a one liner it doesn't use parentheses. And also
becuase YES isn't a string, it's a constant. Do you have warnings
turned on? warnings and strict would catch these sorts of things.

print Yes if $1;   # or
if ($1) {print Yes}

Your choice.


  #!/usr/bin/perl
  use strict;
  use warnings;
 
  while (DATA) {
  if (/AA/ ... /(CC)/) {
  print;
  if ($1) {
  while (DATA) {
  # this regex defines when your section is done
  last if /^\s*$/;
  print;
  }

 # so you don't have to spin over the rest of the file
 last;

  }
  }
  }

I think we need a clearer description of what you want to do here. At
least I do. will your last line have original.1? Or will it have
something else? i don't think anyone knows what the end of
original.1 means. original.1 is a string, and the current code
matches that string. If you need to match the end of the string, use
'/original\.1$/'.

I think, though that you mean the end of some block of lines in your data
file.

It looks to me like you want something along the lines of :

  while() {
if (/allsets/ .. /original\.1/) {
  print;
} elsif (/media/ .. /Total/) {
  print;
}
  }

-- j
--



BOTTOM POST

I got it working and the code I am using is now

open (ARC, archiver -lv |) or die $!;
my $flag=0;
foreach (ARC)
{
if (/(?i)allsets/)
{
$flag=1;
}
if ($flag==1)
{
print $_;
  }
}

as opposed to

if (/allsets/ .. /original1.1/ )

because I needed the data after original1.1.

thank you
derek






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




reg exp using \G

2005-08-02 Thread DBSMITH
All,

I think I am on the right track as far as what assertion to use.  I need to
print from one string to another using .. with \G
My goal is to capture from allsets down.

thank you



Here is my code:

#!/usr/bin/perl
use strict;
use warnings;
$ENV{PATH} = qq(/opt/SUNWsamfs/sbin:/usr/bin);
open (ARC, archiver -lv |) or die $!;

foreach (ARC)
{
##-- Tape --##
if (/allsets/ .. /fs_clinical.1/)
{
print $_;
my $tape =$1;
} else {
  /  \G 'heartlab.1'/
  }
}
close (ARC);

__END_CODE__
__BEGIN_DATA__


Reading '/etc/opt/SUNWsamfs/archiver.cmd'.
1: #wait
2: #
3: logfile = /asmcat/logs/archiver.log
4: #
5: archmax = sg 2G
6: archmax = sf 2G
7: #
8: drives = stk800 6
9: drives = stk900 4
10: #
11: interval = 15m
12: #
13: fs = original1
14: 1 50y
15:
16: back backup
17: 1 -norelease 1m
18: 2 -norelease 1m
19:
20: fs_original . -stage a
21: 1 -norelease 12m
22: 2 -norelease 12m
23: 3 -norelease 12m
24:
25: fs = clinical1
26: 1 50y
27:
28: back backup
29: 1 -norelease 1m
30: 2 -norelease 1m
31:
32: fs_clinical . -stage a
33: 1 -norelease 12m
34: 2 -norelease 12m
35: 3 -norelease 12m
36:
37: #fs = fuji_data
38: #1 50y
39:
40: fs = lanv1
41: 1 50y
42:
43: back backup
44: 1 -norelease 1m
45: 2 -norelease 1m
46:
47: #fs_fuji_data . -stage a
48: #1 -norelease 12m
49: #2 -norelease 12m
50: #3 -norelease 12m
51:
52: fs_lanv1 .
53: 1 -norelease 5m
54: 2 -norelease 5m
55: 3 -norelease 5m
56:
57: fs = heartlab
58: 1 50y
59:
60: back backup
61: 1 -norelease 1m
62: 2 -norelease 1m
63:
64: fs_heartlab .
65: 1 -norelease 12m
66: 2 -norelease 12m
67:
68: fs = lanv
69: 1 50y
70:
71: back backup
72: 1 -norelease 1m
73: 2 -norelease 1m
74:
75: fs_lanvision .
76: 1 -norelease 5m
77: 2 -norelease 5m
78: 3 -norelease 5m
79:
80: fs = darch
81: 1 50y
82: no_archive .
83:
84: params
85: fs_original.1 -sort path -disk_archive disk0
86: fs_original.2 -sort path
87: fs_original.3 -sort path
88:
89: fs_clinical.1 -sort path -disk_archive disk1
90: fs_clinical.2 -sort path
91: fs_clinical.3 -sort path
92:
93: #fs_fuji_data.1 -sort path -disk_archive disk2
94: #fs_fuji_data.2 -sort path
95: #fs_fuji_data.3 -sort path
96:
97: fs_lanv1.1 -sort path -disk_archive disk2
98: fs_lanv1.2 -sort path
99: fs_lanv1.3 -sort path
100:
101: fs_heartlab.1 -sort path
102: fs_heartlab.2 -sort path
103:
104: fs_lanvision.1 -sort path -disk_archive disk3
105: fs_lanvision.2 -sort path
106: fs_lanvision.3 -sort path
107: endparams
108: #
109: #
110:
111: vsns
112: #Backups
113: back.1 sf STK00[0-4]
114: back.2 sf STK00[5-9]
115:
116: # Metadata
117: original1.1 sf STK00[0-4]
118: clinical1.1 sf STK00[0-4]
119: #fuji_data.1 sf STK00[0-4]
120: lanv1.1 sf STK00[0-4]
121: heartlab.1 sf STK00[0-4]
122: lanv.1 sf STK00[0-4]
123: darch.1 sf STK00[0-4]
124:
125: # sg = 9840 media
126: # sf = 9940 media
127:
128: ## Fuji Tape Copies
129: fs_original.2 sg F01[0-9][0-9][0-9]#F01000-F01999
130: fs_original.3 sf F02[0-9][0-9][0-9]#F02000-F02999
131: fs_clinical.2 sg F01[0-9][0-9][0-9]#F01000-F01999
132: fs_clinical.3 sf F02[0-9][0-9][0-9]#F02000-F02999
133: #fs_fuji_data.2 sg F01[0-9][0-9][0-9]  #F01000-F01999
134: #fs_fuji_data.3 sf F02[0-9][0-9][0-9]  #F02000-F02999
135:
136: ## Heartlab Tape Copies
137: ## Tapes H0105[3-9] were physically never put in SILO, somehow
misplaced. --- 05/27/05 DBS
138: ## H02028 is damaged and has been rearchived --- 07/21/05 DBS
139:
140: fs_heartlab.1 sg H01[0-9][0-9][0-9]#H01000-H01999
141: fs_heartlab.2 sf H02[0-9][0-9][0-9]#H02000-H02999
142:
143: ## LANVision Tape Copies
144: fs_lanvision.2 sg L01[0-9][0-9][0-9]   #L01000-L01999
145: fs_lanvision.3 sf L02[0-9][0-9][0-9]   #L02000-L02999
146: fs_lanv1.2 sg L01[0-9][0-9][0-9]   #L01000-L01999
147: fs_lanv1.3 sf L02[0-9][0-9][0-9]   #L02000-L02999
148: endvsns
Notify file: /opt/SUNWsamfs/sbin/archiver.sh

Archive media:
media:sg bufsize: 4 archmax:2.0G Volume overflow not selected
media:sf bufsize: 4 archmax:2.0G Volume overflow not selected

Archive libraries:
Device:stk800 drives_available:7 archive_drives:6
  Catalog:
  sg.STKTAP   capacity:   39.1G space:   39.1G  -il-o-b-
  sg.F01000   capacity:   39.1G space:   38.2G  -il-o-b-
   reserved: fs_clinical.2//
  sg.F01001   capacity:   39.1G space:   38.6G  -il-o-b-
   reserved: fs_original.2//
  sg.F01002   capacity:   39.1G space:   39.1G  -il-o-b-
   reserved: fs_fuji_data.2//
  sg.F01003   capacity:   39.1G space:0 -il-o-bf
  sg.F01004   capacity:   39.1G space:0 -il-o-bf
  sg.F01005   capacity:   39.1G space:0 -il-o-b-
  sg.H01000   capacity:   39.1G space:0 -il-o-bf
  sg.H01001   capacity:   39.1G space:0 -il-o-bf
  sg.H01002   

Re: reg exp using \G

2005-08-02 Thread DBSMITH
Dave,

technically you are correct about escaping the dot, but in this particular
situation my regexp is working.  I will escape the dot.
my goal again is to print from one sting to another from allsets
down.  I apologize for the long output if data, but I want to reflect 100%
accuracy.

Any ideas on a simple for loop with a regexp?

thanks




   
 Dave Gray 
 [EMAIL PROTECTED] 
 omTo 
   beginners@perl.org  
 08/02/2005 02:19   cc 
 PM
   Subject 
   Re: reg exp using \G
 Please respond to 
 Dave Gray 
 [EMAIL PROTECTED] 
om
   
   




On 8/2/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 I think I am on the right track as far as what assertion to use.  I need
to
 print from one string to another using .. with \G

Why do you want to use \G?

 My goal is to capture from allsets down.
 Here is my code:

 #!/usr/bin/perl
 use strict;
 use warnings;
 $ENV{PATH} = qq(/opt/SUNWsamfs/sbin:/usr/bin);
 open (ARC, archiver -lv |) or die $!;

 foreach (ARC)
 {
 ##-- Tape --##
 if (/allsets/ .. /fs_clinical.1/)

You need to escape dots in regular expressions '\.'

 {
 print $_;
 my $tape =$1;

Your regex isn't capturing anything, so $1 will always be undefined.

 } else {
   /  \G 'heartlab.1'/

What are you trying to do here? You need to escape dots in regular
expressions '\.'

   }
 }
 close (ARC);

I think you would benefit greatly from trying to generalize your
problem and writing a simple test script that simulates the problem
you're trying to solve. Then if you're still stuck, post that test
script here, as opposed to that 5 billion line data file which is
mostly irrelevant anyway.

--
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: reg exp using \G

2005-08-02 Thread DBSMITH
yes but the problem is my start point and end point have identical entries
under them.  It is stopping at original1.1 when I need for it to stop at
the end of original1.1 and print

media: sf
 Volumes:
   STK000
 Total space available:   60.8G

as opposed to just allsets to original1.1

For example,  stops at original1.1


for (ARC) {
  print if /allsets/ .. /original1\.1/;
}


and in the data file:

Archive sets:
allsets


back.1
 media: sf
 Volumes:
   STK000
 Total space available:   60.8G

back.2
 media: sf
 Volumes:
   STK005
 Total space available:   60.9G

clinical1.1
 media: sf
 Volumes:
   STK000
 Total space available:   60.8G

darch.1
 media: sf
 Volumes:
   STK000
 Total space available:   60.8G

fs_clinical.1
 Destination: disk1 (/darchive/data1)

fs_clinical.2
 sort:path
 media: sg
 Volumes:
   F01133
   F01134
   F01135
   F01136
   F01137
   F01138
   F01139
   F01140
 Total space available:  151.6G

fs_clinical.3
 sort:path
 media: sf
 Volumes:
   F02029
   F02030
   F02031
   F02032
   F02033
   F02034
   F02035
   F02036
   F02012
 Total space available:  796.1G

fs_heartlab.1
 sort:path
 media: sg
 Volumes:
   H01134
   H01135
   H01136
   H01137
   H01138
   H01139
   H01140
   H01141
   H01142
   H01143
   H01144
   H01145
   H01146
   H01147
   H01148
 Total space available:  308.7G

fs_heartlab.2
 sort:path
 media: sf
 Volumes:
   H02042
   H02035
   H02036
   H02037
   H02038
   H02039
   H02040
   H02041
 Total space available:  641.2G

fs_lanv1.1
 Destination: disk2 (/darchive/data2)

fs_lanv1.2
 sort:path
 media: sg
 Volumes:
   L01000
   L01001
   L01002
   L01003
 Total space available:   92.7G

fs_lanv1.3
 sort:path
 media: sf
 Volumes:
   L02001
   L02002
 Total space available:  377.6G

fs_lanvision.1
 Destination: disk3 (/darchive/data3)

fs_lanvision.2
 sort:path
 media: sg
 Volumes:
   L01000
   L01001
   L01002
   L01003
 Total space available:   92.7G

fs_lanvision.3
 sort:path
 media: sf
 Volumes:
   L02001
   L02002
 Total space available:  377.6G

fs_original.1
 Destination: disk0 (/darchive/data)

fs_original.2
 sort:path
 media: sg
 Volumes:
   F01133
   F01134
   F01135
   F01136
   F01137
   F01138
   F01139
   F01140
 Total space available:  151.6G

fs_original.3
 sort:path
 media: sf
 Volumes:
   F02029
   F02030
   F02031
   F02032
   F02033
   F02034
   F02035
   F02036
   F02012
 Total space available:  796.1G

heartlab.1
 media: sf
 Volumes:
   STK000
 Total space available:   60.8G

lanv.1
 media: sf
 Volumes:
   STK000
 Total space available:   60.8G

lanv1.1
 media: sf
 Volumes:
   STK000
 Total space available:   60.8G

original1.1    Stopping here #
 media: sf
 Volumes:
   STK000
 Total space available:   60.8G

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams




   
 Dave Gray 
 [EMAIL PROTECTED] 
 omTo 
   beginners@perl.org  
 08/02/2005 02:46   cc 
 PM
   Subject 
   Re: reg exp using \G
 Please respond to 
 Dave Gray 
 [EMAIL PROTECTED] 
om
   
   




On 8/2/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 technically you are correct about escaping the dot, but in this
particular
 situation my regexp is working.  I will escape the dot.
 my goal again is to print from one sting to another from allsets
 down.  I apologize for the long output if data, but I want to reflect
100%
 accuracy.

 Any ideas on a simple for loop with a regexp?

for (ARC) {
  print if /one string/ .. /another/;
}

You already had that solution, though. What am I missing?

--
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: code improvement using LABELS within subroutines????

2005-07-22 Thread DBSMITH
thank you,

I will consider all of these.


derek



   
 Scott R. Godin  
 [EMAIL PROTECTED] 
 .net  To 
   beginners@perl.org  
 07/22/2005 02:10   cc 
 PM
   Subject 
   Re: code improvement using LABELS   
   within subroutines  
   
   
   
   
   
   




Jeff 'japhy' Pinyan wrote:
 On Jul 21, [EMAIL PROTECTED] said:

 ok thanks but that does not really help. Sorry.
 your right about finger(), but based on my code I want to execute a
 certain
 block label

 if ( mary)
 finger (mary)

 if (jim)
 finger(jim)


 Oh, then in that case:

   finger($user);

   # ...

   sub finger {
 my $who = shift;

 open GPG, ...;

 if ($who eq 'mary') {
   # ...
 }
 elsif ($who eq 'jim') {
   # ...
 }

 close GPG;
   }


Then again, if you're using Perl 5.7.3 or later, you can use Switch:

use Switch;
use Carp;
finger($user);

sub finger
{
 my $who = shift || croak no user supplied;
 open GPG, ...;
 switch($who) {
 case 'mary' { #... }
 case 'jim'  { #... }
 case 'blah {
 # multiple lines
 # ...
 }
 }
 close GPG;
}

perldoc Switch for details. :)

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




code improvement using LABELS within subroutines????

2005-07-21 Thread DBSMITH
All,

I am wanting to improve my code b/c I am making 3 identical system calls.
So I thought a subroutine with that one call and LABELS for each condition
would improve it.
Is this possible b/c I am getting errors stating cannot find FPR.


 sub finger 
 {  

 open (GPG, gpg --fingerprint |) or die unable to open pipe sys call 
 + (1)... Broken? $!;  

 for (;GPG;)  
 {  
   EXP: if ( /(?i)expires/ )
{   
y-]//d;   
$expdate = +(split)[4]; 
print $expdate,\n;
}   

FPR: if (/talx/ig .. /expire/ig)
{   
 if (/key/i)
 {  
y[Key,fingerprint,=]//d;  
y{ }//d; print FPR $_;  
print Now deleting key\n; 
# call; 
last;   
  } 
}   

KEY: if ( /(?i)pub/ and /(?i)talx/) 
{   
  $keyid = (substr ($_,11,9));  
}   

 }  # END FOR LOOP  

 close (GPG) or die unable to close pipe sys call (0)... Broken? $!;  

 }  # END ROUTINE   

 finger(goto EXP); 








Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
614-566-4145


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




Re: code improvement using LABELS within subroutines????

2005-07-21 Thread DBSMITH
ok thanks but that does not really help. Sorry.
your right about finger(), but based on my code I want to execute a certain
block label

if ( mary)
finger (mary)

if (jim)
finger(jim)

or

if (mary)
finger(goto mary)

if (jim)
finger(goto jim)


Any other ideas to avoid the same system call 3 times?




   
 Jeff 'japhy'  
 Pinyan
 [EMAIL PROTECTED]  To 
 rg   [EMAIL PROTECTED]  
cc 
 07/21/2005 02:34  beginners@perl.org  
 PMSubject 
   Re: code improvement using LABELS   
   within subroutines  
   
   
   
   
   
   




On Jul 21, [EMAIL PROTECTED] said:

 I am wanting to improve my code b/c I am making 3 identical system calls.
 So I thought a subroutine with that one call and LABELS for each
condition
 would improve it.

 sub finger {

 open (GPG, gpg --fingerprint |) or die unable to open pipe sys call
 + (1)... Broken? $!;

 for (;GPG;) {
   EXP: if ( /(?i)expires/ ) { ... }
   FPR: if (/talx/ig .. /expire/ig) { ... }
 KEY: if ( /(?i)pub/ and /(?i)talx/) { ... }
 }  # END FOR LOOP

 close (GPG) or die unable to close pipe sys call (0)... Broken? $!;

 }  # END ROUTINE

That looks fine.  There's really no *need* for the labels, though.  You're
not using them, except below, where you're using them incorrectly:

 finger(goto EXP);

I think you just want to write:

   finger();

I haven't taken a guess at what function(goto XYZ) does, but if I had to,
I'd say it wouldn't end up calling the function at all, and just go to
XYZ, which might be a problem, given that (in your case) the label is
defined INSIDE a function.

--
Jeff japhy Pinyan %  How can we ever be the sold short or
RPI Acacia Brother #734 %  the cheated, we who for every service
http://japhy.perlmonk.org/  %  have long ago been overpaid?
http://www.perlmonks.org/   %-- Meister Eckhart



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




search and replace with a temp file at a certain substr position

2005-07-20 Thread DBSMITH
All,

I need to search a file for a string then set a variable using substr b/c
it is at a certain position, then finally replace the string with another
string.
Here is my test code:


my $gpg=qq(/home/gpghrp/.gnupg);
open (GPG, gpg --fingerprint |) or die unable to
open pipe sys call (1)... Broken? $!;
open(OLD,+$gpg/scripts/gpg_encr.saved) or die
$!;
open(NEW, +$gpg/scripts/gpg_encr.saved.new) or
die $!

for (;OLD;)
{
if ( /(?)readonly tlx=/ ) {
my $ns =substr($_,13,8);
print $_\n;
print $ns\n;
print Now substituting\n;
print NEW s/$ns/blah/;
}

}
close (GPG);
close (SYS);

__END__CODE__

__BEGIN__DATA__

#PUBLIC KEYS

readonly an=809D16DD# Anthem's Key
readonly af=2ADCCA83# Aflac's Key
readonly cb=79A05028# Cenben's Key
readonly ci=FB0E9610# CitiStreet's key
readonly co=DBBFAB1C# Concierge's key
readonly daw=CB0E1CA5   # Dawson's key
readonly df=935A53B4# Definity's key
readonly dl=D357304B# Delta's Key
readonly flxb=31412625  # Flexbank's key
readonly fp=57931F1E# Fireproof's key
readonly hnb=E8D02D63   # Huntington's key
# EF2AA234 32BCF762 # HealthStream's keys.  Set up as a
group
readonly hum=9564F2E1   # Humamarc's key --- non psoft
readonly ohg=D334EB59   # OhioHealth Group's key
readonly merc=0D3C3955  # Mercer's key
readonly ncb=165AAEBD   # National City's key
readonly prvd=2EC1720B  # UnumProvident's key
readonly tlx=886EC5AB   # TALX's key
readonly vsp=03844E3A   # VSP's key
readonly ws=68F0D515# Workscape's key



The coobook CD give an example but not with a substr.
In both files the position od $ns will always be the same.

thank you,
derek




Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams



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




Re: catching signal for an email notification

2005-07-19 Thread DBSMITH
   
 MNibble   
 [EMAIL PROTECTED] 
 deTo 
   beginners@perl.org  
 07/19/2005 09:54   cc 
 AM
   Subject 
   Re: catching signal for an email
   notification
   
   
   
   
   
   









[EMAIL PROTECTED] wrote:
 Perl'ers

 I my code I wrote a routine that executes return code signals.  My point
 being is if after any particular line of code make a call to check its
 success or failure.
 My question is if after any code system call or non system call failure
 according to

 $? == -1
 ?  127 or
 $?  8

 can I send an email with that return code in as the message and or
subject?
 I f so how and what would the code look like?

 thank you,
 derek


 Please see lines 70-84 and 124

 (See attached file: test.pl)


 Derek B. Smith
 OhioHealth IT
 UNIX / TSM / EDM Teams

I', not totaly sure about you if elsif elsif ...
waht about
if ( it breaks )
{
 $content =more on $?;
 mailme($content,$?);
}

sub mailme
{
 my $stuff = Command die with ,shift;
 my $content = lots of text an stuff PLUS more on,shift;


 open(MAIL , | /usr/sbin/sendmail -t) or die $!;
 my $msg = new MIME::Lite ;
 my $tomail=[EMAIL PROTECTED] ;


 $msg = build MIME::Lite
   From= 'your server' ,
   To  = $tomail ,
   Subject = $stuff ,
   Type= 'TEXT',
   Data= $content;

 attach $msg
   Type = text ,
   Path = /test.csv ,
   Encoding = base64,
   Filename = $file.csv ;

 $msg-print(\*MAIL) ;
 close(MAIL) ;
}


-the if it breaks part  --

my $status = $?;

my $error=$status  0x00FF;
my $exam =$status  0xFF00;

if ($error != 0)
{
 print exit value $?\n;
 my $ex1 = ($exam  127);
 print show Signal $ex1 \n;
 my $ex2 = ($exam  128);
 print Coredump$ex2 \n;
}

--

with regards
MNibble




I was sort of confused when you said if it breaks... what breaks my signal
routine?
So is the code correct when I say mailme($!); 

sub signal
{

if ($? == -1) {
print failed to execute: $!\n;
mailme($!);
}
elsif ($?  127) {
printf child dies with signal %d, %s coredump\n,
($?  127), ($?  128) ? 'with core' :
'without core';
mailme($!);
}
elsif ( $?  8) {
printf child exited with value %d\n, $?  8;
mailme($!);
}

}

and what exactly is the-the if it breaks part  --
section?
Will you explain this?  Whats with these hex numbers and why?  Don be
offended just trying to be clear!
Is there anymore error checking I can do to improve its functionality?


thank you,
derek



Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams



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




catching signal for an email notification

2005-07-18 Thread DBSMITH
Perl'ers

I my code I wrote a routine that executes return code signals.  My point
being is if after any particular line of code make a call to check its
success or failure.
My question is if after any code system call or non system call failure
according to

$? == -1
?  127 or
$?  8

can I send an email with that return code in as the message and or subject?
I f so how and what would the code look like?

thank you,
derek


Please see lines 70-84 and 124

(See attached file: test.pl)


Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams


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


answering prompts using expect or perl

2005-07-08 Thread DBSMITH
Yo...what up.

I have wrote this perl program to automatically download a block of strings
specifically a public key.  I opted for cURL instead of lwp but may switch
as of yet.
My question is when I goto sign the new key I am prompted with as in red :


pub  1024D/886EC5AB  created: 2005-03-28 expires: 2005-11-16 trust: -/-
sub  2048g/5973E214  created: 2005-03-28 expires: 2005-11-16
(1). talxcorp11162005 [EMAIL PROTECTED]


pub  1024D/886EC5AB  created: 2005-03-28 expires: 2005-11-16 trust: -/-
 Primary key fingerprint: 782B 62F1 34B7 FC44 62E0  9208 F454 A76C 886E
C5AB

 talxcorp11162005 [EMAIL PROTECTED]

This key is due to expire on 2005-11-16.
Do you want your signature to expire at the same time? (Y/n) y

How carefully have you verified the key you are about to sign actually
belongs
to the person named above?  If you don't know what to answer, enter 0.

   (0) I will not answer. (default)
   (1) I have not checked at all.
   (2) I have done casual checking.
   (3) I have done very careful checking.

Your selection?  3

Really sign? y

You need a passphrase to unlock the secret key for
user: OhioHealth IS (OhioHealth IS Peoplesoft UNIX Support
[EMAIL PROTECTED]
1024-bit DSA key, ID 30B6905A, created 2004-04-07

Enter passphrase:  password


I am thinking expect could accomplish this, but can perl?
I tried using a HEREIS block and that did not work.

thank you,
derek


Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams



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




Re: date range....

2005-06-29 Thread DBSMITH
what is lwp?

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams




   
 Jay Savage
 [EMAIL PROTECTED] 
 l.com To 
   [EMAIL PROTECTED]
 06/23/2005 02:16  [EMAIL PROTECTED], Perl  
 PMBeginners List beginners@perl.org 
cc 
   
 Please respond to Subject 
Jay Savage Re: date range  
 [EMAIL PROTECTED] 
  l.com   
   
   
   
   




On 6/23/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 People of the Perl,

 I have a need to develop some logic to automatically pick up a publc key
 for my gpg keyring.  I will use cURL ( client for URL lookups ) language
 for the actual download , but the catch is the expiration time of our key
 which is 2005-11-16.  So I want to say if calc data =~ current date then
 call cURL.
 I tried an ascii increment but this only incremented from 2005-06-23 to
 2006.  Maybe I am going about this all wrong???
 My like operator really needs to say + - 7 days from 2005-11-16 then call
 cURL and check for a new public key.

 Here is my code:


 require 5.8.0;
 use strict;
 use warnings;

 # for talx expiration date of their pubkey 2005-11-16

 our $time = $^T;
 $ENV{PATH} =
 qq(/home/gpghrp/.gnupg/scripts:/usr/local/bin:/bin:/usr/bin);


 ##--## Begin Routines ##--##

 sub dateme
 {
 my ($year,$month,$day) = (localtime)[5,4,3];
 sprintf (%04d-%02d-%02d\n, ($year += 1900),
 $month+1,$day);
 }
 my $curtdate = dateme();
 #print $curtdate,\n;

 sub date_manip_fwd_6mths
 {
 use constant ONE_DAY = 86400;
 use constant THIRTY_DAYS = ONE_DAY * 30;
 use constant SIX_MTHS = THIRTY_DAYS * 5;
 my $days = (shift);
 my ($y,$m,$d) = (localtime($time + $days)) [5,4,3];
 sprintf (%04d-%02d-%02d, ($y += 1900), $m+1,$d);
 }

 my $calcdate = date_manip_fwd_6mths(SIX_MTHS);
 #print $calcdate,\n;
 #my $calcdate = date_manip_fwd_6mths();


 ##--## Main ##--##
 print $calcdate\n$curtdate;
 if ( $calcdate eq $curtdate ) {
 print YES\n;
 print $calcdate\n$curtdate;
 }

 __END_CODE__

 __BEGIN_DATA__

 2005-11-20
 2005-06-23

Derek,

Check out Date::Calc. I'd do somthing like this:

  #!/usr/bin/perl

  use warnings;
  use strict;

  use Date::Calc qw(Delta_Days);

  my $target = 2005-11-16;

  my ($nowyr, $nowmo, $nowday) = (localtime)[5,4,3];
  my ($taryr, $tarmo, $tarday) = split /-/, $target;

  my $diff = Delta_Days($nowyr + 1900, $nowmo, $nowday, $taryr,
$tarmo, $tarday);

  if ( abs($diff) = 7 ) {
system(curl, args);
# but why not use lwp?
  }


HTH,

-- jay

daggerquill [at] gmail [dot] com
http://www.tuaw.com
http://www.dpguru.com
http://www.engatiki.org

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




reg exp help

2005-06-28 Thread DBSMITH
Can anyone help me with this match:

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


 my $talxkeylog =qq(/home/gpghrp/.gnupg/keys/log/talxkeyupd.log);
open (FH, +$talxkeylog) or warn unable to open file
$talxkeylog $!
;
#cURL();
#print $calcdate\n$curtdate;
my ($lc,$lcc) =$.;
($lc,$lcc) =0;
if ( 2 == 2 ) {

#print FH Time for TALX public key update!\t\n;
#print FH $calcdate\n$curtdate;
#cURL();
for (;FH;)
{
if (/^-{5,}(\w+)/ig) {
print $_;

}
$lc++;
}
}
close (FH);


thanks

I want to print everything from BEGIN TO END and right now all I am
printing is the begin and end lines.



__END_CODE__
__BEGIN _DATA__



-BEGIN PGP PUBLIC KEY BLOCK-
Version: PGP 6.5

mQGiBEJIFiERBAD3c5VkK6sD5+ngCpeRazBdKR416ePaC6irWnIigw7m97W+U+u3
Vuts/+22VxMi+KrXkCn2lq7UcOaeIANN1oDrku2yeJR1rRjwu5+pE5e+kh6rSkuP
Lk3pheiLg/WwC/jqJPsYaPnJ2brC8EVVFi/LFOKtBbkII4wuYJJukZbZtwCg/2ZT
9rvvLane4MwbVfufX/9hBz0D/j8Z+zyWEmLs/bd+l+1NKq2+pHz6K+pVhYfG3hAf
1y7krPWfniXGsrxIDV7rZqKDAyuxhfksGfMWYKLjHfN7Xm8RbGMJJF1NTx8VwhNO
imykmCyYYac+/Dh0C7WmGEOPhlIoG8pTjY/xc7ZoEWpbmHDTXqQA+ztJ6JeXJIEz
OIb0BADP1uozyE1DnRUsW8PUIqCtrcel91qD8PtC7aqmoSkAZ2uVHHRxCp3aGXZV
lc+yuwaK0L7WC9+/+OwAVioeeK3O5rOx9/IDA52Hvy1v5jVNcqODfdck6tc4fLkV
GuIMoVs2AiU/6PJp2VVkYu7zZAFGM9NZBEw26TqsNR7qj+t0urQfdGFseGNvcnAx
MTE2MjAwNSA8cGdwQHRhbHguY29tPokAUwQQEQIAFAUCQkgWIQUJATMtgAQLAwIB
AhkBAAoJEPRUp2yIbsWrN60Al0I67BjENfAvX0tkcL6FyZMnq5cAnRkO8yuXR1ac
mY8ivrh6eB2xcrPquQINBEJIFiEQCAD2Qle3CH8IF3KiutapQvMF6PlTETlPtvFu
uUs4INoBp1ajFOmPQFXz0AfGy0OplK33TGSGSfgMg71l6RfUodNQ+PVZX9x2Uk89
PY3bzpnhV5JZzf24rnRPxfx2vIPFRzBhznzJZv8V+bv9kV7HAarTW56NoKVyOtQa
8L9GAFgr5fSI/VhOSdvNILSd5JEHNmszbDgNRR0PfIizHHxbLY7288kjwEPwpVsY
jY67VYy4XTjTNP18F1dDox0YbN4zISy1Kv884bEpQBgRjXyEpwpy1obEAxnIByl6
ypUM2Zafq9AKUJsCRtMIPWakXUGfnHy9iUsiGSa6q6Jew1XpMgs7AAICCACba3FM
XQz1awim/Qv1+AAPyGeVqjNwBzBHckbbn5ck6ZYEJ9V29FxqB9iKk68vS/Qwc+XJ
g9JUaxyS2f9d88qHISBeHJ+/9a7LXghexO2AraDD8IFGv88zDc9nMsPlh0EXZCTV
SUegpEQB6tuTEYe5B0WOVt2ZIDvHnVkxnZgycwQ0r2Dw2amvkATgoD6IBKGk/WMO
qNrK/zcslGScfNbj5ExQ2az/32tHX/Exuys0Z2ahwkiWj6d0ggKUIFdcnm/m3egd
f9eiGvoHPPLhnFszDt3Dbw2MP6Yorr2l5vJ2VktCpAO3teSKAVNt++UKpb/0Ykik
PhRRq0DyPQ5xlShYiQBMBBgRAgAMBQJCSBYhBQkBMy2AAAoJEPRUp2yIbsWr8Q0A
niD9KAivhqxjhohFPrSWqNYqfRkRAKClRpDGTcVc4WIZQFDjfaACXqJUiA==
=/2pu
-END PGP PUBLIC KEY BLOCK-

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
614-566-4145


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




Re: reg exp help

2005-06-28 Thread DBSMITH
Actually,

you are incorrect... The + mean read and write in append mode.  Please
see the follow up email with the attachment I sent.

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
614-566-4145



   
 bright true   
 [EMAIL PROTECTED] 
 .com  To 
   [EMAIL PROTECTED]
 06/28/2005 10:45  [EMAIL PROTECTED]
 AM cc 
   beginners@perl.org  
   Subject 
 Please respond to Re: reg exp help
bright true
 [EMAIL PROTECTED] 
   .com   
   
   
   




Hello,

First of all you're opening the file for writing

Second i didn't understand what you really want , if you want to print out
everything inside the file

my $file = 'newfile.txt';

open(FILE,$file);
while(FILE){
print $_;}
close(FILE);

That's it with out matching or anything

bye



On 6/28/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  Can anyone help me with this match:

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


  my $talxkeylog =qq(/home/gpghrp/.gnupg/keys/log/talxkeyupd.log);
 open (FH, +$talxkeylog) or warn unable to open file
  $talxkeylog $!
  ;
 #cURL();
 #print $calcdate\n$curtdate;
 my ($lc,$lcc) =$.;
 ($lc,$lcc) =0;
 if ( 2 == 2 ) {

 #print FH Time for TALX public key update!\t\n;
 #print FH $calcdate\n$curtdate;
 #cURL();
 for (;FH;)
 {
 if (/^-{5,}(\w+)/ig) {
 print $_;

 }
 $lc++;
 }
 }
  close (FH);


  thanks

  I want to print everything from BEGIN TO END and right now all I am
  printing is the begin and end lines.



  __END_CODE__
  __BEGIN _DATA__



  -BEGIN PGP PUBLIC KEY BLOCK-
  Version: PGP 6.5

  mQGiBEJIFiERBAD3c5VkK6sD5+ngCpeRazBdKR416ePaC6irWnIigw7m97W+U+u3
  Vuts/+22VxMi+KrXkCn2lq7UcOaeIANN1oDrku2yeJR1rRjwu5+pE5e+kh6rSkuP
  Lk3pheiLg/WwC/jqJPsYaPnJ2brC8EVVFi/LFOKtBbkII4wuYJJukZbZtwCg/2ZT
  9rvvLane4MwbVfufX/9hBz0D/j8Z+zyWEmLs/bd+l+1NKq2+pHz6K+pVhYfG3hAf
  1y7krPWfniXGsrxIDV7rZqKDAyuxhfksGfMWYKLjHfN7Xm8RbGMJJF1NTx8VwhNO
  imykmCyYYac+/Dh0C7WmGEOPhlIoG8pTjY/xc7ZoEWpbmHDTXqQA+ztJ6JeXJIEz
  OIb0BADP1uozyE1DnRUsW8PUIqCtrcel91qD8PtC7aqmoSkAZ2uVHHRxCp3aGXZV
  lc+yuwaK0L7WC9+/+OwAVioeeK3O5rOx9/IDA52Hvy1v5jVNcqODfdck6tc4fLkV
  GuIMoVs2AiU/6PJp2VVkYu7zZAFGM9NZBEw26TqsNR7qj+t0urQfdGFseGNvcnAx
  MTE2MjAwNSA8cGdwQHRhbHguY29tPokAUwQQEQIAFAUCQkgWIQUJATMtgAQLAwIB
  AhkBAAoJEPRUp2yIbsWrN60Al0I67BjENfAvX0tkcL6FyZMnq5cAnRkO8yuXR1ac
  mY8ivrh6eB2xcrPquQINBEJIFiEQCAD2Qle3CH8IF3KiutapQvMF6PlTETlPtvFu
  uUs4INoBp1ajFOmPQFXz0AfGy0OplK33TGSGSfgMg71l6RfUodNQ+PVZX9x2Uk89
  PY3bzpnhV5JZzf24rnRPxfx2vIPFRzBhznzJZv8V+bv9kV7HAarTW56NoKVyOtQa
  8L9GAFgr5fSI/VhOSdvNILSd5JEHNmszbDgNRR0PfIizHHxbLY7288kjwEPwpVsY
  jY67VYy4XTjTNP18F1dDox0YbN4zISy1Kv884bEpQBgRjXyEpwpy1obEAxnIByl6
  ypUM2Zafq9AKUJsCRtMIPWakXUGfnHy9iUsiGSa6q6Jew1XpMgs7AAICCACba3FM
  XQz1awim/Qv1+AAPyGeVqjNwBzBHckbbn5ck6ZYEJ9V29FxqB9iKk68vS/Qwc+XJ
  g9JUaxyS2f9d88qHISBeHJ+/9a7LXghexO2AraDD8IFGv88zDc9nMsPlh0EXZCTV
  SUegpEQB6tuTEYe5B0WOVt2ZIDvHnVkxnZgycwQ0r2Dw2amvkATgoD6IBKGk/WMO
  qNrK/zcslGScfNbj5ExQ2az/32tHX/Exuys0Z2ahwkiWj6d0ggKUIFdcnm/m3egd
  f9eiGvoHPPLhnFszDt3Dbw2MP6Yorr2l5vJ2VktCpAO3teSKAVNt++UKpb/0Ykik
  PhRRq0DyPQ5xlShYiQBMBBgRAgAMBQJCSBYhBQkBMy2AAAoJEPRUp2yIbsWr8Q0A
  niD9KAivhqxjhohFPrSWqNYqfRkRAKClRpDGTcVc4WIZQFDjfaACXqJUiA==
  =/2pu
  -END PGP PUBLIC KEY BLOCK-

  Derek B. Smith
  OhioHealth IT
  UNIX / TSM / EDM Teams
  614-566-4145


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




date range....

2005-06-23 Thread DBSMITH
People of the Perl,

I have a need to develop some logic to automatically pick up a publc key
for my gpg keyring.  I will use cURL ( client for URL lookups ) language
for the actual download , but the catch is the expiration time of our key
which is 2005-11-16.  So I want to say if calc data =~ current date then
call cURL.
I tried an ascii increment but this only incremented from 2005-06-23 to
2006.  Maybe I am going about this all wrong???
My like operator really needs to say + - 7 days from 2005-11-16 then call
cURL and check for a new public key.

Here is my code:


require 5.8.0;
use strict;
use warnings;

# for talx expiration date of their pubkey 2005-11-16

our $time = $^T;
$ENV{PATH} =
qq(/home/gpghrp/.gnupg/scripts:/usr/local/bin:/bin:/usr/bin);


##--## Begin Routines ##--##

sub dateme
{
my ($year,$month,$day) = (localtime)[5,4,3];
sprintf (%04d-%02d-%02d\n, ($year += 1900),
$month+1,$day);
}
my $curtdate = dateme();
#print $curtdate,\n;

sub date_manip_fwd_6mths
{
use constant ONE_DAY = 86400;
use constant THIRTY_DAYS = ONE_DAY * 30;
use constant SIX_MTHS = THIRTY_DAYS * 5;
my $days = (shift);
my ($y,$m,$d) = (localtime($time + $days)) [5,4,3];
sprintf (%04d-%02d-%02d, ($y += 1900), $m+1,$d);
}

my $calcdate = date_manip_fwd_6mths(SIX_MTHS);
#print $calcdate,\n;
#my $calcdate = date_manip_fwd_6mths();


##--## Main ##--##
print $calcdate\n$curtdate;
if ( $calcdate eq $curtdate ) {
print YES\n;
print $calcdate\n$curtdate;
}

__END_CODE__

__BEGIN_DATA__

2005-11-20
2005-06-23




Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
614-566-4145


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




RE: host id

2005-06-10 Thread DBSMITH
I whole heartedly agree!

top post rules!


Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams




   
 Ryan Frantz 
 [EMAIL PROTECTED] 
 med-llc.com   To 
   Wiggins d'Anconia 
 06/09/2005 04:13  [EMAIL PROTECTED], 
 PM[EMAIL PROTECTED]   
cc 
   [EMAIL PROTECTED],  
   beginners@perl.org
   Subject 
   RE: host id 
   
   
   
   
   
   




Sure, don't top-post.  But then who's gonna bother to scroll to the end
of the email as the thread gets longer?  Many users don't even realize
that there is a reply in bottom-posted emails.  Bottom-posting ignores
the natural behavior of most users.

Another example of human behavior (top vs. bottom):

Q: Where's the first place your eyes take you when you visit a web page?
A: The upper left quadrant of the page.  Not the bottom.

As an added note, just get over it.  It's nothing to sweat.

ry

-Original Message-
From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 09, 2005 4:02 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; beginners@perl.org
Subject: Re: host id

Because it's up-side down.
Why is that?
It makes replies harder to read.
Why not?
Please don't top-post. - Sherm Pendley, Mac OS X list

[EMAIL PROTECTED] wrote:
 I, being too lazy to look up a perl function, would use hostname
command in
 backticks like so:

 $HostID = `hostname`;


Right which is why the above is too lazy. Anyone reading this please
don't settle for the above, it is error prone, insecure, and
insufficient. There is no error checking, there at least needs to be a
full path, and it is potentially slower.

 Not sure if that will catch a newline character so I would also follow
it
 with this:

 $HostID =~ s/\n//;

Right, in which case we can at least suggest 'chomp',

perldoc -f chomp

http://danconia.org


 -Original Message-
 From: Bret Goodfellow [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 09, 2005 3:36 PM
 To: beginners@perl.org
 Subject: host id


 Simple question to answer, I hope. I am running on an HP-UX system,
and
 would like to retrive the UNIX system's host-id (name of box). Is
there
 a function to do this?



--
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: host id

2005-06-10 Thread DBSMITH
   
 [EMAIL PROTECTED] 
 rum-health.org
To 
 06/10/2005 10:55  beginners@perl.org  
 AM cc 
   
   Subject 
   RE: host id 
   
   
   
   
   
   







 Ryan Frantz wrote:
  For the purposes of this list, I shall always post intelligently as
  has been stated ... For continuity, I
  would suggest everyone does the same.

 Excellent suggestion.

 For those who would like to post replies in the preferred
 conversational
 style or inline style (or whatever you want to call it)
 using Outlook or
 Outlook Express, a quick google for outlook quotefix or oe
 quotefix will
 turn up some wonderful little tools to make such posts a breeze.

For outlook it's Tools/Options/Email Options/When replying to an email
message

Choose Prefix each line of the original message

It probably should be noted that I'm using outlook 2000. (Until microsoft
stops granting licenses for 2000 and forces us to shell out more money for
the upgrade :)




Any suggestions for Lotus Notes?

derek




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




Re: host id

2005-06-10 Thread DBSMITH
yeah thanks... company email system... Ar... notes is evil.
for that fact IBM is evil!





   
 Dave Gray 
 [EMAIL PROTECTED] 
 omTo 
   beginners@perl.org  
 06/10/2005 02:31   cc 
 PM
   Subject 
   Re: host id 
 Please respond to 
 Dave Gray 
 [EMAIL PROTECTED] 
om
   
   




On 6/10/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 I whole heartedly agree!

 top post rules!

Apparently, so does Lotus Notes. My deepest sympathies.

--
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: assigning printf statement to an array

2005-06-07 Thread DBSMITH
Please help on how to use the functionality of my date_manip1 subroutine to
pass it the days old to
get the past date dd/mm/yy as such:

ABDELFATTAH__FAITH_M702515438:  101   dd/mm/yy


thank you,
derek


Here is my code:

use strict;
use warnings;
$ENV{PATH} = qq(/opt/SUNWsamfs/sbin:/usr/bin:/usr/sbin:/usr/local/log);

my $hdir = qq(/heartlab/db studies/);
my $fdir = qq(/fuji/original/RMH/);
$^T=time;
our $now = time();
use constant ONE_DAY = 86400;




#sub date_manip1
#   {
#my $days = (shift);
#my ($d, $m, $y) = (localtime($now - ($days * ONE_DAY)))
[3..5];
#sprintf (%02d/%02d/%02d, $m+1,$d,($y % 100));
#}

#my $dmm = date_manip1($0);
#chomp $dm;
#chomp $dmm;



#sub secondsold
#{
opendir (HDH, $hdir) or die unable to open directory: $hdir $!;

my ($d, $m, $y) = (localtime($now - (map {$_-[0]} *
ONE_DAY))) [3..5];
printf (%02d/%02d/%04d, $m+1,$d,($y % 100));
grep {$_-[0]  100}
map { [ sprintf (%.0f,($now - ( stat( ${hdir}$_ ) )[9]
) * ONE_DAY ),

$_
] }
grep {$_ ne . and $_ ne ..}
sort readdir HDH;
#print @a,\n;

closedir (HDH) or warn unable to close HDH: $hdir $!;
#   }

___END CODE___

___BEGIN DATA___

Days old of HL image files are: 0_LEARY_ALANRA002848:   150
Days old of HL image files are: ABDELFATTAH__FAITH_M702515438:  101







   
 [EMAIL PROTECTED] 
 h.com 
To 
 05/24/2005 09:18  beginners@perl.org  
 PM cc 
   
   Subject 
   Re: assigning printf statement to   
   an array
   
   
   
   
   
   




operdir .

1 print
2 map {$_-[1].: .$_-[0].\n} # create entity output
3 grep {$_-[0]  100} # exclude age = 100
4 map { [
5  sprintf (%.0f,( $now - ( stat(${hdir}$_ ) )[9] ) / ONE_DAY ),
6  $_
7 ] } # create aref [age, filename]
8 grep {$_ ne . and $_ ne ..} # exclude unwanted
9 sort readdir DH; # get all files

closedir ...


In the block of code  :

   how does the perl compiler load this, from line 9 up or opendir down?
   And what is the correct way to read it from top down or bottom up?
   what is the purpose of an array reference in this code and what is it
   advantages?
   on pg 253 of the camel book it states if the next thing after the - is
   a bracket, then the left operand ($_ ) is treated as a reference to an
   array to be subscripted on the right [0] or [1] .  So is this array
   declared/created dynamically?  How?
   on line 2 why is the period after [1] needed and what does it represent
   , string concatenation?  If so why are multiple ones needed on line 2?
   so [1] contains the dir name and [0] contains the my days old
   calculation, correct?
   how does map know to create this array b/c I thought map expects a list
   that is already created?
   from the previous question... is this list the opendir?  I guess am not
   totally grasping the map function.
   in lines 5 and 6 $_ is the dir, but why is it needed at  the very end at
   line 6 after the comma?
   to the end, output of days old  100 I am now trying to use my
   date_manip1 subroutine to pass it the days old to get the past date
   dd/mm/yy as such:
  line 3 turns into date_manip1(grep {$_-[0]  100} ) so I have
output as :

ABDELFATTAH__FAITH_M702515438:  101   dd/mm/yy
I am on the right track?

thank you,

derek



 John Doe
 security.departm
 [EMAIL PROTECTED]  To
   beginners@perl.org
 05/24/2005 03:27   cc
 PM
   Subject
   Re: assigning printf statement to
 

Re: assigning printf statement to an array

2005-05-26 Thread DBSMITH
DITTO!


THANKS Men!

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams




   
 John Doe  
 security.departm 
 [EMAIL PROTECTED]  To 
   beginners@perl.org  
 05/25/2005 04:48   cc 
 PM
   Subject 
   Re: assigning printf statement to   
   an array
   
   
   
   
   
   




Am Mittwoch, 25. Mai 2005 04.10 schrieb Jeff 'japhy' Pinyan:

[...]

Jeff, thanks a lot for taking over.
My explanation would not have been so understandable and with this
fullness.

joe

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




bold print to a FH

2005-05-26 Thread DBSMITH
All,

I want to have bold print of a Title but it is not working.  Here is my
code:

require 5.6.1;

use strict;
use warnings;
use diagnostics;
use MIME::Lite;
use Term::ANSIColor;
use Logfile::Rotate;
$^T=time;
our $now   = time();
our $tapes = qq(/var/tmp/volrpt.log);
our $mt= (stat($tapes))[9];
our $tsl   = qq(/var/tmp/tapefile_status.log);
our $media = qq(/usr/local/log/FUJI_HRTLAB_SHLTH_tapes.xls);
$ENV{PATH} = qq(/opt/SUNWsamfs/sbin:/usr/bin:/usr/sbin:/usr/local/log);



###--### Begin Routines ###--###


sub mediausage
{
open (TPC,/usr/local/bin/ohiohealth/tpcount.pl |  ) or
die unable to fork tpcount.pl $!;
open (MU, $media) or die unable to open file: $media
$!;
print color 'bold'; print MU Media Usage Key for all ASM
clients:,  , dateme();

while (TPC) {

print MU $_, \n;
}
}

__END_CODE__

When I view the file my header Media Usage Key for all ASM clients it is
not in bold, but my screen becomes bold print.

any advise?
thanks

derek




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




Re: bold print to a FH

2005-05-26 Thread DBSMITH
the code

 print MU color 'bold', BLAH BLAH BLAH \n;

is not working with error:


Uncaught exception from user code:
Invalid attribute name media at disk_cache-tape_slot-usage.pl line
45
Carp::croak('Invalid attribute name media') called at
/usr/perl5/5.6.1/lib/Term/ANSIColor.pm line 119
Term::ANSIColor::color('bold', 'Media Usage Key for all ASM
clients:', ' ', '17:35   05/26/05^J') called at
disk_cache-tape_slot-usage.pl line 45
main::mediausage() called at disk_cache-tape_slot-usage.pl line


   
 Jay Savage
 [EMAIL PROTECTED] 
 l.com To 
   [EMAIL PROTECTED]
 05/26/2005 05:03  [EMAIL PROTECTED]
 PM cc 
   beginners@perl.org  
   Subject 
 Please respond to Re: bold print to a FH  
Jay Savage 
 [EMAIL PROTECTED] 
  l.com   
   
   
   




On 5/26/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 All,

 I want to have bold print of a Title but it is not working.  Here is my
 code:

 require 5.6.1;

 use strict;
 use warnings;
 use diagnostics;
 use MIME::Lite;
 use Term::ANSIColor;
 use Logfile::Rotate;
 $^T=time;
 our $now   = time();
 our $tapes = qq(/var/tmp/volrpt.log);
 our $mt= (stat($tapes))[9];
 our $tsl   = qq(/var/tmp/tapefile_status.log);
 our $media = qq(/usr/local/log/FUJI_HRTLAB_SHLTH_tapes.xls);
 $ENV{PATH} = qq(/opt/SUNWsamfs/sbin:/usr/bin:/usr/sbin:/usr/local/log);



 ###--### Begin Routines ###--###


 sub mediausage
 {
 open (TPC,/usr/local/bin/ohiohealth/tpcount.pl |  ) or
 die unable to fork tpcount.pl $!;
 open (MU, $media) or die unable to open file: $media
 $!;
 print color 'bold'; print MU Media Usage Key for all ASM
 clients:,  , dateme();

 while (TPC) {

 print MU $_, \n;
 }
 }

 __END_CODE__

 When I view the file my header Media Usage Key for all ASM clients it
is
 not in bold, but my screen becomes bold print.

 any advise?
 thanks

 derek




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




1) Term:ANSIColor is a terminal setting.

There is no such thing as writing bold to a file.  You need to write
data that will be interpreted by whatever you intend to use to view
it.  for instance, to output html, you would use `print MU
strongtext/strong;`.  To write a file you'll read from a
terminal, you need to print the appropriate escape sequence for the
terminal you're using.

2) You have specified `color 'bold'` for the stdout filehandle, but
not the MU filehandle.  You can use `print MU color 'bold'` to cause
the escape sequence (probably \e[1m) to be written to file.  Note,
though, that this will not be protable, and printing the escape
sequence to screen on any terminal other than the one intended can
cause unintended results and require you reset the connection.
Embedding escape sequences in files is a bad idea.  It's much better
to use some kind of markup, and write a program to parse the markup
and output the correct, site-specific escapes when the data is read,
e.g., `print color 'bold' if =~ /bold;`

Also, don't forget to turn `color` off, or your screen will remain
bold, even after the program exits.

HTH,

-- jay

daggerquill [at] gmail [dot] com
http://www.engatiki.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: bold print to a FH

2005-05-26 Thread DBSMITH
yes of course I read it otherwise I would of not of sent an email! This is
a help list correct?

thanks


Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams




   
 Jay Savage
 [EMAIL PROTECTED] 
 l.com To 
   Perl Beginners List 
 05/26/2005 05:54  beginners@perl.org
 PM cc 
   
   Subject 
 Please respond to Re: bold print to a FH  
Jay Savage 
 [EMAIL PROTECTED] 
  l.com   
   
   
   




On 5/26/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 the code

  print MU color 'bold', BLAH BLAH BLAH \n;

 is not working with error:


 Uncaught exception from user code:
 Invalid attribute name media at disk_cache-tape_slot-usage.pl
line
 45
 Carp::croak('Invalid attribute name media') called at
 /usr/perl5/5.6.1/lib/Term/ANSIColor.pm line 119
 Term::ANSIColor::color('bold', 'Media Usage Key for all ASM
 clients:', ' ', '17:35   05/26/05^J') called at
 disk_cache-tape_slot-usage.pl line 45
 main::mediausage() called at disk_cache-tape_slot-usage.pl line



  Jay Savage
  [EMAIL PROTECTED]
  l.com
To
[EMAIL PROTECTED]
  05/26/2005 05:03  [EMAIL PROTECTED]
  PM
cc
beginners@perl.org

Subject
  Please respond to Re: bold print to a FH
 Jay Savage
  [EMAIL PROTECTED]
   l.com







 On 5/26/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  All,
 
  I want to have bold print of a Title but it is not working.  Here is my
  code:
 
  require 5.6.1;
 
  use strict;
  use warnings;
  use diagnostics;
  use MIME::Lite;
  use Term::ANSIColor;
  use Logfile::Rotate;
  $^T=time;
  our $now   = time();
  our $tapes = qq(/var/tmp/volrpt.log);
  our $mt= (stat($tapes))[9];
  our $tsl   = qq(/var/tmp/tapefile_status.log);
  our $media = qq(/usr/local/log/FUJI_HRTLAB_SHLTH_tapes.xls);
  $ENV{PATH} =
qq(/opt/SUNWsamfs/sbin:/usr/bin:/usr/sbin:/usr/local/log);
 
 
 
  ###--### Begin Routines ###--###
 
 
  sub mediausage
  {
  open (TPC,/usr/local/bin/ohiohealth/tpcount.pl |  )
or
  die unable to fork tpcount.pl $!;
  open (MU, $media) or die unable to open file:
$media
  $!;
  print color 'bold'; print MU Media Usage Key for all
ASM
  clients:,  , dateme();
 
  while (TPC) {
 
  print MU $_, \n;
  }
  }
 
  __END_CODE__
 
  When I view the file my header Media Usage Key for all ASM clients it
 is
  not in bold, but my screen becomes bold print.
 
  any advise?
  thanks
 
  derek
 
 
 
 
  --
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  http://learn.perl.org/ http://learn.perl.org/first-response
 
 
 

 1) Term:ANSIColor is a terminal setting.

 There is no such thing as writing bold to a file.  You need to write
 data that will be interpreted by whatever you intend to use to view
 it.  for instance, to output html, you would use `print MU
 strongtext/strong;`.  To write a file you'll read from a
 terminal, you need to print the appropriate escape sequence for the
 terminal you're using.

 2) You have specified `color 'bold'` for the stdout filehandle, but
 not the MU filehandle.  You can use `print MU color 'bold'` to cause
 the escape sequence (probably \e[1m) to be written to file.  Note,
 though, that this will not be protable, and printing the escape
 sequence to screen on any terminal other than the one intended can
 cause unintended results and require you reset the connection.
 Embedding escape sequences in files is a bad idea.  It's much better
 to use some kind of markup, and write a program to parse the markup
 and output the correct, site-specific escapes when the data is read,
 e.g., `print color 'bold' if =~ /bold;`

 Also, don't forget to turn `color` off, or your screen will remain
 bold, even after the program exits.

 HTH,

 -- 

Re: assigning printf statement to an array

2005-05-24 Thread DBSMITH
my @a=
map {$hdir.$_-[1]} # select filename
grep {$_-[0]  100} # exclude age = 100
map { [
  sprintf (%.0f,( $now - ( stat(${hdir}$_ ) )[9] ) / ONE_DAY ),
  $_
 ] } # create aref [age, filename]
grep {$_ ne . and $_ ne ..} # exclude unwanted
sort readdir DH; # get all files


The map-grep-map-construct is quite common for problems like yours
(But I cannot use $_ b/c $_ is the dir name.).



This is working but it not printing the calculation days old for each
filename???  I want to print the aref.
I verified that it is indeed only printing those files over 100 days old,
but I need output such as,

ABDELFATTAH__FAITH_M702515438:  101

as opposed to

ABDELFATTAH__FAITH_M702515438

I will also follow up with a line by line question of the code.
thanks again!
derek




Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams




   
 John Doe  
 security.departm 
 [EMAIL PROTECTED]  To 
   beginners@perl.org  
 05/24/2005 01:34   cc 
 AM
   Subject 
   Re: assigning printf statement to   
   an array
   
   
   
   
   
   




Am Montag, 23. Mai 2005 20.05 schrieb [EMAIL PROTECTED]:
 Hi all.

 This is a continuation from my original question, but with a twist.  I am
 now using sprintf to assign to an array, but I only want to assign to
this
 array of I find a number over 100 from my calculation.  In the array/hash
 also needs to be the directory name.  Here is my code and the sample
 output:
 So in the end my goal is to store the data in this array if the number is
 over 100 and if it is over 100 store the directory name and its
associative
 days old calc.
 I have tried my @a =(); my $e =0;
 $a[$e++] = sprintf (%.0f,( $now - ( stat( ${hdir}${file} ) )[9] ) /
 ONE_DAY ) if ???  100;

 But I cannot use $_ b/c $_ is the dir name.

 thank you,

 derek




 use strict;
 use warnings;
 $ENV{PATH} = qq(/opt/SUNWsamfs/sbin:/usr/bin:/usr/sbin:/usr/local/log);

 my $hdir   = qq(/heartlab/db studies/);
 #my $fdirs =
 qq(/fuji/original/RMH/,/fuji/original/GMC/,/fuji/clinical/GMC/,/fuj
 i/clinical/RMH/);
 $^T=time;
 our $now = time();
 use constant ONE_DAY = 86400;


 sub date_manip
 {
 my ($month, $day, $year) = (localtime)[4,3,5];
 sprintf (%02d/%02d/%02d\n, $month+1,$day,($year %
100));
 }

 my $dm = date_manip;

 sub date_manip1
 {
 my $days = (shift);
 my ($d, $m, $y) = (localtime($now - $days * ONE_DAY))
 [3..5];
 sprintf (%02d/%02d/%02d, $m+1,$d,($y % 100));
 }

 #my $dmm = date_manip1(1);
 #chomp $dm;
 #chomp $dmm;



 opendir (DH, $hdir) or die unable to open directory: $hdir $!;

 my @a =();
 my $e =0;
 foreach my $file (sort readdir (DH))
 {
 next if $file eq . or $file eq ..;
 print \n;
 print Days old of HL image files are:\t,$file,:\t;
 #printf (%.0f, ( $now - ( stat( ${hdir}${file} ) )[9]
)
 / ONE_DAY );
 $a[$e++] = sprintf (%.0f,( $now - ( stat(
 ${hdir}${file} ) )[9] ) / ONE_DAY );
 #date_manip1($1);
 }


instead of the foreach loop you could use a single statement [untested]:
(read from bottom to top)

my @a=
map {$hdir.$_-[1]} # select filename
grep {$_-[0]  100} # exclude age = 100
map { [
  sprintf (%.0f,( $now - ( stat(${hdir}$_ ) )[9] ) / ONE_DAY ),
  $_
 ] } # create aref [age, filename]
grep {$_ ne . and $_ ne ..} # exclude unwanted
sort readdir DH; # get all files


The map-grep-map-construct is quite common for problems like yours
(But I cannot use $_ b/c $_ is the dir name.).

(Schwarz'sche Transformation in german).


hth, joe


 closedir (DH) or warn unable to close DH: $hdir $!;

 ___END CODE___

 ___BEGIN_DATA___

 Days old of HL image files are: 0_LEARY_ALANRA002848:   68
 Days old of HL image files are: AARON_YAZAWA_CHRISTEHD006871:   48
 Days old of HL image files are: 

Fw: assigning printf statement to an array

2005-05-24 Thread DBSMITH
- Forwarded by Derek Smith/Staff/OhioHealth on 05/24/2005 03:47 PM
-
   
 Derek 
 Smith/Staff/OhioH 
 ealth  To 
   John Doe
 05/24/2005 12:05  [EMAIL PROTECTED]  
 PM cc 
   beginners@perl.org  
   Subject 
   Re: assigning printf statement to   
   an array(Document link: Derek   
   Bellner Smith)  
   
   
   
   
   
   



my @a=
map {$hdir.$_-[1]} # select filename
grep {$_-[0]  100} # exclude age = 100
map { [
  sprintf (%.0f,( $now - ( stat(${hdir}$_ ) )[9] ) / ONE_DAY ),
  $_
 ] } # create aref [age, filename]
grep {$_ ne . and $_ ne ..} # exclude unwanted
sort readdir DH; # get all files


The map-grep-map-construct is quite common for problems like yours
(But I cannot use $_ b/c $_ is the dir name.).



This is working but it not printing the calculation days old for each
filename???  I want to print the aref.
I verified that it is indeed only printing those files over 100 days old,
but I need output such as,

ABDELFATTAH__FAITH_M702515438:  101

as opposed to

ABDELFATTAH__FAITH_M702515438

I will also follow up with a line by line question of the code.
thanks again!
derek




Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams




   
 John Doe  
 security.departm 
 [EMAIL PROTECTED]  To 
   beginners@perl.org  
 05/24/2005 01:34   cc 
 AM
   Subject 
   Re: assigning printf statement to   
   an array
   
   
   
   
   
   




Am Montag, 23. Mai 2005 20.05 schrieb [EMAIL PROTECTED]:
 Hi all.

 This is a continuation from my original question, but with a twist.  I am
 now using sprintf to assign to an array, but I only want to assign to
this
 array of I find a number over 100 from my calculation.  In the array/hash
 also needs to be the directory name.  Here is my code and the sample
 output:
 So in the end my goal is to store the data in this array if the number is
 over 100 and if it is over 100 store the directory name and its
associative
 days old calc.
 I have tried my @a =(); my $e =0;
 $a[$e++] = sprintf (%.0f,( $now - ( stat( ${hdir}${file} ) )[9] ) /
 ONE_DAY ) if ???  100;

 But I cannot use $_ b/c $_ is the dir name.

 thank you,

 derek




 use strict;
 use warnings;
 $ENV{PATH} = qq(/opt/SUNWsamfs/sbin:/usr/bin:/usr/sbin:/usr/local/log);

 my $hdir   = qq(/heartlab/db studies/);
 #my $fdirs =
 qq(/fuji/original/RMH/,/fuji/original/GMC/,/fuji/clinical/GMC/,/fuj
 i/clinical/RMH/);
 $^T=time;
 our $now = time();
 use constant ONE_DAY = 86400;


 sub date_manip
 {
 my ($month, $day, $year) = (localtime)[4,3,5];
 sprintf (%02d/%02d/%02d\n, $month+1,$day,($year %
100));
 }

 my $dm = date_manip;

 sub date_manip1
 {
 my $days = (shift);
 my ($d, $m, $y) = (localtime($now - $days * ONE_DAY))
 [3..5];
 sprintf (%02d/%02d/%02d, $m+1,$d,($y % 100));
 }

 #my 

Re: assigning printf statement to an array

2005-05-24 Thread DBSMITH
operdir .

1 print
2 map {$_-[1].: .$_-[0].\n} # create entity output
3 grep {$_-[0]  100} # exclude age = 100
4 map { [
5  sprintf (%.0f,( $now - ( stat(${hdir}$_ ) )[9] ) / ONE_DAY ),
6  $_
7 ] } # create aref [age, filename]
8 grep {$_ ne . and $_ ne ..} # exclude unwanted
9 sort readdir DH; # get all files

closedir ...


In the block of code  :

   how does the perl compiler load this, from line 9 up or opendir down?
   And what is the correct way to read it from top down or bottom up?
   what is the purpose of an array reference in this code and what is it
   advantages?
   on pg 253 of the camel book it states if the next thing after the - is
   a bracket, then the left operand ($_ ) is treated as a reference to an
   array to be subscripted on the right [0] or [1] .  So is this array
   declared/created dynamically?  How?
   on line 2 why is the period after [1] needed and what does it represent
   , string concatenation?  If so why are multiple ones needed on line 2?
   so [1] contains the dir name and [0] contains the my days old
   calculation, correct?
   how does map know to create this array b/c I thought map expects a list
   that is already created?
   from the previous question... is this list the opendir?  I guess am not
   totally grasping the map function.
   in lines 5 and 6 $_ is the dir, but why is it needed at  the very end at
   line 6 after the comma?
   to the end, output of days old  100 I am now trying to use my
   date_manip1 subroutine to pass it the days old to get the past date
   dd/mm/yy as such:
  line 3 turns into date_manip1(grep {$_-[0]  100} ) so I have
output as :

ABDELFATTAH__FAITH_M702515438:  101   dd/mm/yy
I am on the right track?

thank you,

derek


   
 John Doe  
 security.departm 
 [EMAIL PROTECTED]  To 
   beginners@perl.org  
 05/24/2005 03:27   cc 
 PM
   Subject 
   Re: assigning printf statement to   
   an array
   
   
   
   
   
   




Hi

Am Dienstag, 24. Mai 2005 18.05 schrieb [EMAIL PROTECTED]
with funny quoting:

[John:]
 my @a=
 map {$hdir.$_-[1]} # select filename
 grep {$_-[0]  100} # exclude age = 100
 map { [
   sprintf (%.0f,( $now - ( stat(${hdir}$_ ) )[9] ) / ONE_DAY ),
   $_
  ] } # create aref [age, filename]
 grep {$_ ne . and $_ ne ..} # exclude unwanted
 sort readdir DH; # get all files


 The map-grep-map-construct is quite common for problems like yours
 (But I cannot use $_ b/c $_ is the dir name.).


[Derek:]
 This is working but it not printing the calculation days old for each
 filename???

No, obviously not... I wanted to demonstrate the principle where
some kind of additional attributes (here: age) of a list of entities
(files)
is created on the fly and kept together (in an aref), and taken as base for

further treatment (selection). [ Hope this english is understandable :-) ]

 I want to print the aref.
 I verified that it is indeed only printing those files over 100 days old,
 but I need output such as,

 ABDELFATTAH__FAITH_M702515438:  101

 as opposed to

 ABDELFATTAH__FAITH_M702515438

Ok, then some minimal changes in the first two lines are necessary
(although
there are other possibilities to do what you want; my proposal is possibliy

not the most performant, but splits the problem into smaller parts that can

be chaned)
[also untested...]

print
map {$_-[1].: .$_-[0].\n} # create entity output
grep {$_-[0]  100} # exclude age = 100
map { [
  sprintf (%.0f,( $now - ( stat(${hdir}$_ ) )[9] ) / ONE_DAY ),
  $_
 ] } # create aref [age, filename]
grep {$_ ne . and $_ ne ..} # exclude unwanted
sort readdir DH; # get all files

 I will also follow up with a line by line question of the code.

Just go on, questions are half of the answers :-)

joe


[...]
[maybe I should have snipped the rest?]
 Am Montag, 23. Mai 2005 20.05 schrieb [EMAIL PROTECTED]:
  Hi all.
 
  This is a continuation from my original question, but with a twist.  I
am
  now using sprintf to assign to an array, 

Re: assigning printf statement to an array

2005-05-23 Thread DBSMITH
Hi all.

This is a continuation from my original question, but with a twist.  I am
now using sprintf to assign to an array, but I only want to assign to this
array of I find a number over 100 from my calculation.  In the array/hash
also needs to be the directory name.  Here is my code and the sample
output:
So in the end my goal is to store the data in this array if the number is
over 100 and if it is over 100 store the directory name and its associative
days old calc.
I have tried my @a =(); my $e =0;
$a[$e++] = sprintf (%.0f,( $now - ( stat( ${hdir}${file} ) )[9] ) /
ONE_DAY ) if ???  100;

But I cannot use $_ b/c $_ is the dir name.


thank you,

derek




use strict;
use warnings;
$ENV{PATH} = qq(/opt/SUNWsamfs/sbin:/usr/bin:/usr/sbin:/usr/local/log);

my $hdir   = qq(/heartlab/db studies/);
#my $fdirs =
qq(/fuji/original/RMH/,/fuji/original/GMC/,/fuji/clinical/GMC/,/fuj
i/clinical/RMH/);
$^T=time;
our $now = time();
use constant ONE_DAY = 86400;


sub date_manip
{
my ($month, $day, $year) = (localtime)[4,3,5];
sprintf (%02d/%02d/%02d\n, $month+1,$day,($year % 100));
}

my $dm = date_manip;

sub date_manip1
{
my $days = (shift);
my ($d, $m, $y) = (localtime($now - $days * ONE_DAY))
[3..5];
sprintf (%02d/%02d/%02d, $m+1,$d,($y % 100));
}

#my $dmm = date_manip1(1);
#chomp $dm;
#chomp $dmm;



opendir (DH, $hdir) or die unable to open directory: $hdir $!;

my @a =();
my $e =0;
foreach my $file (sort readdir (DH))
{
next if $file eq . or $file eq ..;
print \n;
print Days old of HL image files are:\t,$file,:\t;
#printf (%.0f, ( $now - ( stat( ${hdir}${file} ) )[9] )
/ ONE_DAY );
$a[$e++] = sprintf (%.0f,( $now - ( stat(
${hdir}${file} ) )[9] ) / ONE_DAY );
#date_manip1($1);
}
closedir (DH) or warn unable to close DH: $hdir $!;

___END CODE___

___BEGIN_DATA___

Days old of HL image files are: 0_LEARY_ALANRA002848:   68
Days old of HL image files are: AARON_YAZAWA_CHRISTEHD006871:   48
Days old of HL image files are: AARON_YAZAWA_CHRISTERF015357:   64
Days old of HL image files are: ABBOTT_ANNA_MAERF014496:49
Days old of HL image files are: ABBOTT_CONSTANCEMK003126:   69
Days old of HL image files are: ABBOTT_DONALDHE011252:  67
Days old of HL image files are: ABBOTT_FLORENCE068148_15857:20
Days old of HL image files are: ABBOTT_HARRYRA002652:   68
Days old of HL image files are: ABBOTT_THOMASMK61:  66
Days old of HL image files are: ABBOTT__FLORENCEHC008241:   20
Days old of HL image files are: ABBRUZZESE_BETTYMK004528:   78
Days old of HL image files are: ABBRUZZESE_BETTYML002169:   80
Days old of HL image files are: ABDALLA__PATRICIAHA014365:  56
Days old of HL image files are: ABDELFATTAH_FAITH0702515438:98
Days old of HL image files are: ABDELFATTAH__FAITH_M702515438:  101
Days old of HL image files are: ABDULLAHI__ABDIRAHMAMJ003339:   62
Days old of HL image files are: ABELL_MARKRF015325: 66
Days old of HL image files are: ABEL_HUBERTMJ003654:21
Days old of HL image files are: ABEL_RICHARDMK003922:   82
Days old of HL image files are: ABEL_STEVENHD007640:75
Days old of HL image files are: ABEL_STEVENRA003253:75
Days old of HL image files are: ABEL__LARRYRF013486:73




Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams



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




RE: timestamp conversion

2005-05-18 Thread DBSMITH
Charles and the Perl beginners,

thx for the response.  But how do I ,from below, convert seconds old to a
date?
From my docs Mtime shows me a timestamp of when the file was last changed.

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams




   
 Charles K.   
 Clarkson 
 [EMAIL PROTECTED]  To 
 .net beginners@perl.org
cc 
 05/18/2005 12:26  
 AMSubject 
   RE: timestamp conversion
   
   
   
   
   
   




[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:

: All,
:
: My goal is to get element 9 of stat which is mtime.  I am
: getting this with ease, but my end goal is to convert this
: number back into a readable format giving me how old the file
: is.

Are you sure mtime tracks file age? I was under the impression
that that was not what it did on most operating systems.


: So here is a rough draft formula :  (time in seconds  -  last
: MTime ) = seconds old.
:
: Convert seconds old to a human readable time stamp using localtime ();
: Any ideas or is there a better way?

That looks right. Your code is missing a closing quote. You might
commify the result as 1106803146 isn't very human readable.

HTH,

Charles K. Clarkson
--
Mobile Homes Specialist
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





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




RE: timestamp conversion

2005-05-18 Thread DBSMITH
ok here is what I did:

I took

(now in seconds - last MTime ) =  seconds old

seconds old / ( 60x60x24)

the divisor gives me in days how old the file is.


Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams




   
 Charles K.   
 Clarkson 
 [EMAIL PROTECTED]  To 
 .net beginners@perl.org
cc 
 05/18/2005 12:26  
 AMSubject 
   RE: timestamp conversion
   
   
   
   
   
   




[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:

: All,
:
: My goal is to get element 9 of stat which is mtime.  I am
: getting this with ease, but my end goal is to convert this
: number back into a readable format giving me how old the file
: is.

Are you sure mtime tracks file age? I was under the impression
that that was not what it did on most operating systems.


: So here is a rough draft formula :  (time in seconds  -  last
: MTime ) = seconds old.
:
: Convert seconds old to a human readable time stamp using localtime ();
: Any ideas or is there a better way?

That looks right. Your code is missing a closing quote. You might
commify the result as 1106803146 isn't very human readable.

HTH,

Charles K. Clarkson
--
Mobile Homes Specialist
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





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




sprintf is now working

2005-05-18 Thread DBSMITH
I am getting this error, can anyone help?

thanks
derek

# perl -c dir.pl
Useless use of sprintf in void context at dir.pl line 29.
dir.pl syntax OK

#!/usr/bin/perl
use strict;
use warnings;
use Time::localtime;
$ENV{PATH} = qq(/opt/SUNWsamfs/sbin:/usr/bin:/usr/sbin:/usr/local/log);

my $hdir   = qq(/heartlab/db studies/);
#$^T=time;
our $now = time();
use constant ONE_DAY = 86400;
#our $now = localtime();


opendir (DH, $hdir) or die unable to open directory: $hdir $!;

foreach my $file (sort readdir (DH))
{
next if $file eq . or $file eq ..;
print Last modified time timestamps in $hdir
are:\t,$file,:\t,\n;
sprintf (%.03f,($now - (stat(${hdir}${file}))[9])/86400);
}

closedir (DH) or warn unable to close DH: $hdir $!;

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
614-566-4145


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




timestamp conversion

2005-05-17 Thread DBSMITH

All,

My goal is to get element 9 of stat which is mtime.  I am getting this with
ease, but my end goal is to convert this number back into a readable format
giving me how old the file is.

So here is a rough draft formula :  (time in seconds  -  last  MTime ) =
seconds old.

Convert seconds old to a human readable time stamp using localtime ();
Any ideas or is there a better way?

thank you,




Here is my code:



#!/usr/bin/perl
use strict;
use warnings;
$ENV{PATH} = qq(/opt/SUNWsamfs/sbin:/usr/bin:/usr/sbin:/usr/local/log);

#my $fdirs =
qq(/fuji/original/RMH/*,/fuji/original/GMC/*,/fuji/clinical/GMC/*,/fuji/clinical/RMH/*);
#my $fdirs = qq(/fuji/original/RMH/0*);


my $hdir   = qq(/heartlab/db studies/);
$^T=time;
our $now   = time();


#sub dateme
# {
#  my ($hour,$min,$month,$day,$year) =
(localtime)[2,1,4,3,5];
#  sprintf (%02d:%02d   %02d/%02d/%02d\n,
$hour,$min,$month+1,$day,($year % 100));
#}
#
#  my $dm = dateme;

opendir (DH, $hdir) or die unable to open directory: $hdir $!;

  foreach my $file (sort readdir (DH))
  {
   next if $file eq . or $file eq ..;
   print All file timestamps in $hdir
are:\t,$file,:\t,(stat(${hdir}${file}))[9],\n;
   #print Last modified time timestamps in $hdir
are:\t,$file,:\t, ($now - (stat(${hdir}${file}))[9])*60,\n;
  }

closedir (DH) or warn unable to close DH: $hdir $!;




Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams



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




calling a separate perl script from within another perl script

2005-05-11 Thread DBSMITH
All,

I have done some reading and know there are various way to do this, but
want to if there is an ideal way to call a non local perl script.
I know it probably matters what one is doing, but in my case all I want to
do is print the data from one script to the FH of another.
The ways I know about are

   do 'FILE' ;
   use lib ...//;
   require ...//.../
   use IPC::open
  open(MYSCRIPT, foo arg1 $otherargs | ) or die$!;
  scalar=MYSCRIPT;
  close (MYSCRIPT);



 isn't use and require the OO way?  




thx...
derek

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams



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




Re: populating a hash with % used as the key and F string as the value

2005-05-03 Thread DBSMITH
John,
I am a lotus user so my top-down reply is default ...sorry.


I think all looks good, but I have to ask why are you initializing an array
to hold values of a hash with keys?

This could be written the long way (but now to be read
topdown):
my @keys=keys %lookup;
my @sorted_keys=sort {$a = $b} @keys;
my @per_key_strings;
foreach my $k (@sorted_keys) {
push @per_key_strings,
$k . :  .  (   join , , @{$lookup{$_}}   );
}
print join \n, @per_key_strings;

My whole purpose was to populate a hash like so:

my %hash = {

  F01000 = '0%',
  F01001 = '10%',
  F01002 = '100%',
};

If one cannot and should not push a hash, then what is the ideal way to
populate a hash. like so?
for ( FH) {
 for my $d (keys %HoA) {
print $d: @{$HoA{$d} }\n;
 }
}

OR
  my %HoA = ();
  for (FH ) {
  $HoA{$i++} = (split)[-1]
}


thx again...derek



   
 John Doe  
 security.departm 
 [EMAIL PROTECTED]  To 
   beginners@perl.org  
 05/03/2005 12:37   cc 
 AM
   Subject 
   Re: populating a hash with % used   
   as the key and F string as  the 
   value   
   
   
   
   
   
   




Am Dienstag, 3. Mai 2005 03.30 schrieb [EMAIL PROTECTED]:
  * If the format of all your data lines is consistent, you could use

 split

  on \s+ to get the data fields instead of a tr/m cascade.
 
  * Then, if I understand you correctly, you wantto build a hash with %

 keys

  and F... values. This could be done with code like
 
  push @{$lookup_hash{$pct_value}}, $F_value;
 
  eventually, you even want a 2nd level hash with the F field number as

 key,

  if the F values are unique over the whole file and the last field alway
  begins with an F.

 === test5.pl ===
 #!/usr/bin/perl

 use warnings; use strict;

 my @lines=split \n, EOF;
 1 2005/01/20 15:39   17   2%  -il-o-b-  sg F01000
 2 2005/01/20 15:53   14   1%  -il-o-b-  sg F01001
 3 2005/01/18 09:532   0%  -il-o-b-  sg F01002
 4 2005/02/04 16:41  196 100%  -il-o-bf  sg F01003
 5 2005/02/05 21:13  305 100%  -il-o-bf  sg F01004
 EOF

 my %lookup;
 foreach (@lines) {
 my @fields=split /\s+/;
 push @{$lookup{$fields[4]}}, $fields[7];
 }

 print join \n, map {$_.: .(join , , @{$lookup{$_}})} sort {$a =
$b}

 keys %lookup;
 print \n;
 === end test5 pl ===

 This prints:

 0%: F01002
 1%: F01001
 2%: F01000
 100%: F01003, F01004

 

 ok thank you, but a few questions:

 1) In programming Perl, it states one cannot push or pop a hash on page
10
 paragraph 2.  You cannot push or pop a has b/c it does not make sense; a
 hash has no beginning nor end.

True :-)

 Why does Oreilly's PP 3rd edition say this?

Hm... because its true :-))

 It looks like you are pushing data elements from @lines into
 %lookup, correct?

(Please bear with my english while I try to explain...)

The data structure built in the foreach loop looks like

my %lookup=(
 key1 =
  ['val1a', 'val1b'] # etc. - note A
 key2 =
  ['val2a', 'val2b'] # etc. - note B
)

This means that key1 and key2 are (ordinary) hash keys, and the lines
commented with note A/B are (nearly ordinary) scalar values: The scalars
are not 123 or string, but arrayrefs (which are, like all refs, scalar
values).

The push is done at the end of these _dereferenced_ arrayrefs (read: the
arrays). These arrays are initialized automagically at the time of the
first
push to them.

The dereferencing is done by the '@{}' in

 push @{   $lookup{$fields[4]}   },
 $fields[7];

while
 $lookup{$fields[4]}

itself is the reference to the array (read: an arrayref).


 2)  Is this :  print join \n, map {$_.: .(join , , @{$lookup{$_}})}
 sort {$a = $b}

  stating

 for every $_ construct or default 

Re: populating a hash with % used as the key and F string as the value

2005-05-02 Thread DBSMITH
 * If the format of all your data lines is consistent, you could use
split
 on \s+ to get the data fields instead of a tr/m cascade.

 * Then, if I understand you correctly, you wantto build a hash with %
keys
 and F... values. This could be done with code like

 push @{$lookup_hash{$pct_value}}, $F_value;

 eventually, you even want a 2nd level hash with the F field number as
key,
 if the F values are unique over the whole file and the last field alway
 begins with an F.


=== test5.pl ===
#!/usr/bin/perl

use warnings; use strict;

my @lines=split \n, EOF;
1 2005/01/20 15:39   17   2%  -il-o-b-  sg F01000
2 2005/01/20 15:53   14   1%  -il-o-b-  sg F01001
3 2005/01/18 09:532   0%  -il-o-b-  sg F01002
4 2005/02/04 16:41  196 100%  -il-o-bf  sg F01003
5 2005/02/05 21:13  305 100%  -il-o-bf  sg F01004
EOF

my %lookup;
foreach (@lines) {
my @fields=split /\s+/;
push @{$lookup{$fields[4]}}, $fields[7];
}

print join \n, map {$_.: .(join , , @{$lookup{$_}})} sort {$a = $b}

keys %lookup;
print \n;
=== end test5 pl ===

This prints:

0%: F01002
1%: F01001
2%: F01000
100%: F01003, F01004



ok thank you, but a few questions:

1) In programming Perl, it states one cannot push or pop a hash on page 10
paragraph 2.  You cannot push or pop a has b/c it does not make sense; a
hash has no beginning nor end.  Why does Oreilly's PP 3rd edition say
this?  It looks like you are pushing data elements from @lines into
%lookup, correct?

2)  Is this :  print join \n, map {$_.: .(join , , @{$lookup{$_}})}
sort {$a = $b}
 stating for every $_ construct or default variable,  join newline to a
map of  :  any character with a comma then space then the data elements
from $lookup
 sorted.

3) I know I can populate an array like so: my (@array, $i )  = (); forech
(FH) { $array[$i++] }
 As an example, is it incorrect to do likewise to a hash as so:
my %HoA = ();
for (FH ) {
  $HoA{$i++} = (split)[-1]
   }
4)  for my $d (keys %HoA) {
 print $d: @{$HoA{$d} }\n;
  }

 This was from copied from programming perl and strict did not complain
and prints out the hash values.  Is there a better way?



thxx...


derek


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




populating a hash with % used as the key and F string as the value

2005-05-01 Thread DBSMITH
I was thinking of using a hash of arrays b/c I want to look-up each array
by a certain string and that string would the % string.
My goal is to populate a hash of some sort with the % string and its
associated F string.
Here is the data file:

 1 2005/01/20 15:39   17   2%  -il-o-b-  sg F01000
 2 2005/01/20 15:53   14   1%  -il-o-b-  sg F01001
 3 2005/01/18 09:532   0%  -il-o-b-  sg F01002
 4 2005/02/04 16:41  196 100%  -il-o-bf  sg F01003
 5 2005/02/05 21:13  305 100%  -il-o-bf  sg F01004

#!/usr/bin/perl
use strict;
use warnings;
$ENV{PATH} = qq(/opt/SUNWsamfs/sbin:/usr/bin:/usr/sbin:/usr/local/log);
open (V4, samcmd v4 21 | ) or die unable to open pipe... Broken? $!;
my %HoA = ();
my $i =0;
foreach (V4) {
s sg ();
s {\-*} ()g;
s {\w+} ();
$HoA{$i++} = (split)[-1] if (m/f01(\d+)  (\d+%) /gi  );

}
close (V4) or die unable to close pipe $!;
print \n;

for my $d (keys %HoA) {
   print $d: @{ $HoA{$d} }\n;
 }



thank you,
derek


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




Re: populating a hash with % used as the key and F string as the value

2005-05-01 Thread DBSMITH
John,

the reg exp s -+ ();
   ^
was changed to

  y/sg//;;
y/-//d;
s{\w+} ();
to exclude the spaces and use y... thx
why are thre operators y or tr more efficient since these operators do not
use pattern matching?

Originally I was using an array, actually 2 arrays one with all f string s
and one with all % strings.
To me it makes more sense to use a hash b/c each F string needs to be
pulled with its associative n% string.
This is why I want to populate a hash of arrays.

Below is what is should of read for my population of the hash.

$HoA{$i++} = (split)[-1] if (m/f01(\d+)(\d+%) /gi  );




ciao,

derek : )



   
 John W. Krahn   
 [EMAIL PROTECTED] 
   To 
   Perl Beginners beginners@perl.org 
 05/01/2005 08:30   cc 
 PM
   Subject 
   Re: populating a hash with % used   
   as the key and F string as  
   thevalue
   
   
   
   
   
   




[EMAIL PROTECTED] wrote:
 I was thinking of using a hash of arrays b/c I want to look-up each array
 by a certain string and that string would the % string.
 My goal is to populate a hash of some sort with the % string and its
 associated F string.
 Here is the data file:

  1 2005/01/20 15:39   17   2%  -il-o-b-  sg F01000
  2 2005/01/20 15:53   14   1%  -il-o-b-  sg F01001
  3 2005/01/18 09:532   0%  -il-o-b-  sg F01002
  4 2005/02/04 16:41  196 100%  -il-o-bf  sg F01003
  5 2005/02/05 21:13  305 100%  -il-o-bf  sg F01004

 #!/usr/bin/perl
 use strict;
 use warnings;
 $ENV{PATH} = qq(/opt/SUNWsamfs/sbin:/usr/bin:/usr/sbin:/usr/local/log);
 open (V4, samcmd v4 21 | ) or die unable to open pipe... Broken?
$!;
 my %HoA = ();
 my $i =0;
 foreach (V4) {
  s sg ();
^
The whitespace there will not work for all versions of Perl.  Are you sure
that it works for you?


  s {\-*} ()g;

The hyphen is not special in a regular expression, it does not need to be
escaped.  You are telling the substitution operator to replace all zero
occurrences of '-' which is unnecessary.

$ perl -Mre=debug -e'$_ = q[ 1 2005/01/20 15:39   17   2%  -il-o-b-

sg F01000]; s{-*} ()g;' 21 | grep -c 'Match successful'
55
$ perl -Mre=debug -e'$_ = q[ 1 2005/01/20 15:39   17   2%  -il-o-b-

sg F01000]; s{-+} ()g;' 21 | grep -c 'Match successful'
4

As you can see the regex '-*' matches 55 times while the regex '-+' only
matches 4 times.

Besides, it would be more efficient to use the transliteration operator.

   tr/-//d;


 s {\w+} ();
  $HoA{$i++} = (split)[-1] if (m/f01(\d+)  (\d+%) /gi  );

You are storing the value of $i as the key which starts at 0 and is
incremented for each line of input so why not just use an array and push
the
values onto it?  You have included the string '  ' in your regular
expression but I don't see that string anywhere in your data?  You are
using
capturing parentheses in the regular expression but you are not using those
captured strings anywhere?


 }
 close (V4) or die unable to close pipe $!;
 print \n;

 for my $d (keys %HoA) {
print $d: @{ $HoA{$d} }\n;

You are trying to use a scalar value ($HoA{$d}) as an array which strict
should complain about.

  }


John
--
use Perl;
program
fulfillment

--
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: REGEXP removing - il- - -b-f and - il- - - - f

2005-04-29 Thread DBSMITH
So which is safer more ideal to use :   || , or


Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams




   
 John W. Krahn   
 [EMAIL PROTECTED] 
   To 
   Perl Beginners beginners@perl.org 
 04/28/2005 07:55   cc 
 PM
   Subject 
   Re: REGEXP removing - il- - -b-f
   and - il- - - - f   
   
   
   
   
   
   




Jay Savage wrote:
 On 4/27/05, John W. Krahn [EMAIL PROTECTED] wrote:

Jay Savage wrote:

4 open (V4, samcmd v4 2\1 | ) || die unable to open pipe...
Broken?$!;

Don't do this.  the precedence of || is too high.  your code attempts
to open a pipe, and if it can't, then it attempts to open die... and
starts throwing exceptions.

No, that is NOT what happens, it will NEVER attempt to open die... with
or
without the parentheses.  The ONLY time it will attempt to open die...
is if
there are no parentheses and the expression on the left hand side of the
||
operator evaluates to false.

open V4, '0' || die $!;

But even then it will NOT attempt to open die... because die() exits
the
program!

 Is stand corrected.  There is no exception; I guess any time I've run
 into it, I've relied on whatever was opened, and died anyway.  But I
 don't know what else to call opens behavior, except attempting to open
 die.  Except in the case of parenthesis, as you noted, the behavior of
 open || die sure looks like this to me:  open (X, badfile || die).
 The only difference between the two expressions below is the
 precedence of the operator.

 [EMAIL PROTECTED]:~ perl -e 'open FH,  BAdFiLe || die $!'
 [EMAIL PROTECTED]:~ perl -e 'open FH,  BAdFiLe or die $!'
  No such file or directory at -e line 1.

 Open may not technically be trying to open an expression and failing,
 I don't know.  To be honest, I've never taken apart the source to see.
  But the appearance is certainly that that's what happens, and the
 result is so similar as to not matter.  Especially consider the
 following:

 perl -e 'open FH,  BAdFiLe || die or die $!; print didnt die\n
'
  No such file or directory at -e line 1.

 Where did the first die go if || didn't attempt to pass it to open?

 if the reason for the failed open were the attempt to open BAdFiLe,
 the first die would execute and the program would exit bore it got to
 the second.  But clearly that's not what's happening.  The first die
 is getting slurped up by ||, which is presumably trying to pass it on
 to open.  When that fails, the second die executes, exiting with $!.
 at least that's what it looks like to me.

 So what's really happeneing here?

perldoc perlop

[snip]

  C-style Logical Or

  Binary || performs a short-circuit logical OR operation.  That is,
if
 ^
  the left operand is true, the right operand is not even evaluated.
^^^

Perhaps this will help illustrate:

$ perl -MO=Deparse,-p -e'open IN, BADFILE || die ERROR: $!'
open(IN, 'BADFILE');
-e syntax OK
$ perl -MO=Deparse,-p -e'open IN, BADFILE || die or die ERROR: $!'
(open(IN, 'BADFILE') or die(ERROR: $!));
-e syntax OK

Because the string BADFILE is true, which is determined at compile time,
it
is as if || die did not exist at all!

Of course if the file name is in a variable then it must be evaluated at
run time:

$ perl -MO=Deparse,-p -e'open IN, $ARGV[0] || die ERROR: $!' BADFILE
open(IN, ($ARGV[0] || die(ERROR: $!)));
-e syntax OK
$ perl -MO=Deparse,-p -e'open IN, $ARGV[0] || die or die ERROR: $!'
BADFILE
(open(IN, ($ARGV[0] || die)) or die(ERROR: $!));
-e syntax OK

Where || die will only be evaluated if the variable is false (undef, 0,
'0'
or '').



John
--
use Perl;
program
fulfillment

--
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/ 

Re: REGEXP removing - il- - -b-f and - il- - - - f

2005-04-29 Thread DBSMITH
well,  I am trying to get beyond a beginner as I have doing Perl for 3
years now so is your answer still the same?

thanks,

derek



   
 Ing. Branislav   
 Gerzo
 [EMAIL PROTECTED]   To 
   beginners@perl.org  
 04/29/2005 09:09   cc 
 AM
   Subject 
   Re: REGEXP removing - il- - -b-f
   and - il- - - - f   
   
   
   
   
   
   




[EMAIL PROTECTED] [D], on Friday, April 29, 2005 at 08:43 (-0400)
thoughtfully wrote the following:

DSo which is safer more ideal to use :   || , or

I think or is better - it makes perl language more readable for
beginners.

--

How do you protect mail on web? I use http://www.2pu.net

[Join the Navy and see the world...  Through a porthole.]



--
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: REGEXP removing - il- - -b-f and - il- - - - f

2005-04-27 Thread DBSMITH
yes I agree I was a little ambiguous... I was in a hurry. sorry.  Anyway
here is my updated code. and here is a sample output:
My goal is to get all F01 which I am but I am having issues capturing all
of these values into my array.  When I run the I get the data I want to see
which is just the F01 column, but when I comment out line 14 and uncomment
line 15 and uncomment line 21 I see no data in the array???
In the end I want the F01 column and the % column.

thank you,

derek

 1 2005/01/20 15:39   17   2%  -il-o-b- - - - -  sg F01000
   2 2005/01/20 15:53   14   1%  -il-o-b-  sg F01001
   3 2005/01/18 09:532   0%  -il-o-b-  sg F01002
   4 2005/02/04 16:41  196 100%  -il-o-bf  sg F01003
   5 2005/02/05 21:13  305 100%  -il-o-bf  sg F01004
   6 2005/02/28 22:47  180 100%  -il-o-b-  sg F01005
  13 2005/02/08 16:07  112 100%  -il-o-bf  sg F01006
  14 2005/02/09 21:56  122 100%  -il-o-bf  sg F01007
  15 2005/02/11 10:51  147 100%  -il-o-bf  sg F01008
  16 2005/02/13 11:35  193 100%  -il-o-bf  sg F01009
  17 2005/02/14 23:46   79 100%  -il-o-b- - - -f  sg F01010


#!/usr/bin/perl
1 use strict;
2 use warnings;
3 $ENV{PATH} =
qq(/opt/SUNWsamfs/sbin:/usr/bin:/usr/sbin:/usr/local/log);
4 open (V4, samcmd v4 2\1 | ) || die unable to open pipe... Broken?
$!;
5 my @fa =();
6 my @ha =();
7 my $i =0;
8foreach (V4) {
9   local $, = \n;
10  #print +(split)[6,7], $,;
11  s sg ();
12  s {\-*} ()g;
13s {\w+} ()i;
14print +(split)[5,6,7], if (m/f01(\d+)/gi )
15   #$fa[$i++] = +(split)[5,6,7] if (m/f01(\d+)/gi );
16   #print +(split)[4],$,; #% column
17  }
18 close (V4);
19 print \n;
20 print Now printing array element 0\t, $fa[0], \n;
21 #print Now printing entire array \t, @fa, \n;
22 print Now printing array count \t, $#fa, \n;





Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams




   
 Ing. Branislav   
 Gerzo
 [EMAIL PROTECTED]   To 
   beginners@perl.org  
 04/27/2005 02:46   cc 
 AM
   Subject 
   Re: REGEXP  
   
   
   
   
   
   




[EMAIL PROTECTED] [D], on Tuesday, April 26, 2005 at 17:12
(-0400) made these points:

D s/sg//, s/\- {1,}(\w{1,})//,print +(split)[5,6,7], if (m/f01(\d+)/gi )

I think no one replied to you because we don't know what should be
output.

--

How do you protect mail on web? I use http://www.2pu.net

[I am a Jello's God! shouted Yahweh, quivering in anger.]



--
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: REGEXP removing - il- - -b-f and - il- - - - f

2005-04-27 Thread DBSMITH
yes that is true, [5,6,7]  need to be typed otherwise all entries are not
accounted for.

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
614-566-4145



   
 JupiterHost.Net 
 [EMAIL PROTECTED] 
 st.netTo 
   beginners@perl.org  
 04/27/2005 11:13   cc 
 AM
   Subject 
   Re: REGEXP removing - il- - -b-f
   and - il- - - - f   
   
   
   
   
   
   





 If all you want is the last column, this is a really long way to go about
it.

 while (V4) {
 print (split)[7];
 print \n;
 }

I think that won't work due to some rows formatted like so:

2005/01/20 15:39   17   2%  -il-o-b- - - - -  sg F01000

unless that was typo?

In that case 7 isn't always the index of the last item in the list
from split.

while (V4) {
 my @tmp = split;
 print $tmp[ $#tmp ]\n;
}

 This should be enough to get you started.  On the whole, though, I'd
 seriously recommend that you pick up a copy of a good intro perl book
 (_Learning Perl_ springs to mind), and read the FAQ for this group on
 how to identify (bad) examples of Perl 4 code, which it seems you've
 been looking at.

I second that!

--
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: REGEXP removing - il- - -b-f and - il- - - - f

2005-04-27 Thread DBSMITH
perl people there was a lot of threads to my question ...thank you!  I
will start from the most recent.

 I took and understood the advise of my @a = (); changed to my @a;
Yes I do understand the differing precedence between or and | | .  I have a
habit using | |.  I do also understand that if you use or you should use  (
) as opposed to | | you do not have to use ( ).  Any comments?

Line 15 is changed to, I forgot ti take out the + . $fa[$i++] =
(split)[-1] if (m/f01(\d+)/gi );
But I do not understand what the (split)[-1] is saying?  please explain.


I reran the code and it seems to be working now.
thanks again, : )
ciao!


#!/usr/bin/perl
1 use strict;
2 use warnings;
3 $ENV{PATH} =
qq(/opt/SUNWsamfs/sbin:/usr/bin:/usr/sbin:/usr/local/log);
4 open (V4, samcmd v4 2\1 | ) || die unable to open pipe... Broken?
$!;
5 my @fa =();
6 my @ha =();
7 my $i =0;
8foreach (V4) {
9   local $, = \n;
10  #print +(split)[6,7], $,;
11  s sg ();
12  s {\-*} ()g;
13s {\w+} ()i;
14print +(split)[5,6,7], if (m/f01(\d+)/gi )
15   #$fa[$i++] = +(split)[5,6,7] if (m/f01(\d+)/gi );
16   #print +(split)[4],$,; #% column
17  }
18 close (V4);
19 print \n;
20 print Now printing array element 0\t, $fa[0], \n;
21 #print Now printing entire array \t, @fa, \n;
22 print Now printing array count \t, $#fa, \n;



Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
614-566-4145



   
 JupiterHost.Net 
 [EMAIL PROTECTED] 
 st.netTo 
   beginners@perl.org  
 04/27/2005 12:03   cc 
 PM
   Subject 
   Re: REGEXP removing - il- - -b-f
   and - il- - - - f   
   
   
   
   
   
   




 I was assuming it was a typo/email munge, and that the command he
 pipes actually produces consistent output.  That may be a faulty
 assumption on my part.  YOu know what they say about assumptions In

Its hard to say Derek doesn't give us much to work with :)

 general, though, when parsing log files (which seems to be waht's
 going on here) if you're assured reasonably consisten data, it's
 better IMNSHO to look for a particular index, because loggers are more
 likely to add occasional extranious info or comments at the end of the
 line than in the middle.

Yeah, I imagine you're correct in your assumption, without actual valid
info its hard to tell :)

Basically if you're gauranteed it index 7 use index 7, otherwise if
you're gauranteed its the last item (and it may be 7 and it may not be(
use the $#array version, if you can't do either redo it all based on
hoew the output is. And if you post to the list about it please send
accurate info.

--
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: REGEXP removing - il- - -b-f and - il- - - - f

2005-04-27 Thread DBSMITH
I am confused with your email.

what does (split) [-1]   mean?

Finally,

Yes I do understand the differing precedence between or and | | .  I have a
habit using | |.  I do also understand that if you use or you should use  (
) as opposed to | | you do not have to use ( ).  Any comments?

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
614-566-4145



   
 JupiterHost.Net 
 [EMAIL PROTECTED] 
 st.netTo 
   beginners@perl.org  
 04/27/2005 02:26   cc 
 PM
   Subject 
   Re: REGEXP removing - il- - -b-f
   and - il- - - - f   
   
   
   
   
   
   






[EMAIL PROTECTED] wrote:
 yes that is true, [5,6,7]  need to be typed otherwise all entries are not

Yes what is true? Please reply inline.

--
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: REGEXP removing - il- - -b-f and - il- - - - f

2005-04-27 Thread DBSMITH
all f01 records are not printed if one uses print +(split)[7]
rather print +(split)[5,6,7] will print all f01 records.


sorry
derek



   
 JupiterHost.Net 
 [EMAIL PROTECTED] 
 st.netTo 
   beginners@perl.org  
 04/27/2005 02:26   cc 
 PM
   Subject 
   Re: REGEXP removing - il- - -b-f
   and - il- - - - f   
   
   
   
   
   
   






[EMAIL PROTECTED] wrote:
 yes that is true, [5,6,7]  need to be typed otherwise all entries are not

Yes what is true? Please reply inline.

--
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: REGEXP removing - il- - -b-f and - il- - - - f

2005-04-27 Thread DBSMITH
I will answer and ask all questions in one email!  k.

 $!;
 5 my @fa =();
 6 my @ha =();
 7 my $i =0;
 8foreach (V4) {

 Is there any good reason to slurp the entire file into memory?

What would you suggest?  I want to read the entire file via a filehandle.
I have plenty of system memory, therefore why not?



 You are using the match in a boolean context so the /g option makes no
sense.
 15   #$fa[$i++] = +(split)[5,6,7] if (m/f01(\d+)/gi );

If I do not use the /g modifier then it will not slurp the entire file or
all instances of F01,  I tried it without /g and it did not work.


The value of $#fa is not the number of elements in the array, for that you
want to use the array in scalar context:

print Now printing array count \t, scalar @fa, \n;

Or:

print Now printing array count \t . @fa . \n;


In my Learning Perl 2nd edition and Programming Perl 3rd edition, no where
does it say use
scaler @fa to get the element count, rather it says use $#fa.  Is there
something I am unaware of or was $# deprecated recently?

Why is scaler @fa better/more correct than $#fa?

I have been told that my @a = ( ); is more correct than my @a, but now I am
confused b/c others are telling me otherwise???  Personally, I like my @a =
( );
because it lets me know explicitly that this array is now initialized to 0
elements, plus its faster at compile time...KUDOS to John Kran!

From Jupiter :

  You do realize that the characters 'F', '0' and '1' are included in the
 character class \w which split() is removing?  :-)

yeah I realized that typo too late :), I meant \s not \w but then plain
old my @tmp = split; is even better :)

But I thought spit by default separates on whitespace?  And F, 0 and 1 are
indeed apart of char classes \w  and \d?

Finally no one has answered my question what does (split)[-1] mean?


thank you!
derek


Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams




   
 John W. Krahn   
 [EMAIL PROTECTED] 
   To 
   Perl Beginners beginners@perl.org 
 04/27/2005 05:24   cc 
 PM
   Subject 
   Re: REGEXP removing - il- - -b-f
   and - il- - - - f   
   
   
   
   
   
   




[EMAIL PROTECTED] wrote:
 yes I agree I was a little ambiguous... I was in a hurry. sorry.  Anyway
 here is my updated code. and here is a sample output:
 My goal is to get all F01 which I am but I am having issues capturing all
 of these values into my array.  When I run the I get the data I want to
see
 which is just the F01 column, but when I comment out line 14 and
uncomment
 line 15 and uncomment line 21 I see no data in the array???
 In the end I want the F01 column and the % column.

You only want the two columns, that looks simple enough:

while ( V4 ) {
 my ( $percent, $f01 ) = /(\d+%).*?(f01\d+)/i or next;
 print $percent  $f01\n;
 }


  1 2005/01/20 15:39   17   2%  -il-o-b- - - - -  sg F01000
2 2005/01/20 15:53   14   1%  -il-o-b-  sg F01001
3 2005/01/18 09:532   0%  -il-o-b-  sg F01002
4 2005/02/04 16:41  196 100%  -il-o-bf  sg F01003
5 2005/02/05 21:13  305 100%  -il-o-bf  sg F01004
6 2005/02/28 22:47  180 100%  -il-o-b-  sg F01005
   13 2005/02/08 16:07  112 100%  -il-o-bf  sg F01006
   14 2005/02/09 21:56  122 100%  -il-o-bf  sg F01007
   15 2005/02/11 10:51  147 100%  -il-o-bf  sg F01008
   16 2005/02/13 11:35  193 100%  -il-o-bf  sg F01009
   17 2005/02/14 23:46   79 100%  -il-o-b- - - -f  sg F01010


SNIP
John
--
use Perl;
program
fulfillment

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




REGEXP

2005-04-26 Thread DBSMITH
Please help me find the regexp to replace -o-b- - - -f
thank you!

s/sg//, s/\- {1,}(\w{1,})//,print +(split)[5,6,7], if (m/f01(\d+)/gi )


my $_ has these lines in it:

-o-b- - - -f
F01045

-o-b- - - -f
F01046

-o-b- - - -f
F01047

-o-b- - - -f
F01048

-o-b- - -f
F01049

-o-b- - - -f
F01050

-o-b- - - -f
F01051


Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
614-566-4145


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




initialize arrays

2005-04-05 Thread DBSMITH
Are these two statements the same?

my (@array, @array1) = ( );

my @array = my @array1 = ( );



Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams



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




RE: initialize arrays

2005-04-05 Thread DBSMITH
I am just playing with variable assign.  I always initialize my arrays
first as I need them.
thanks,

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams



   
 Charles K.   
 Clarkson 
 [EMAIL PROTECTED]  To 
 .net beginners@perl.org
cc 
 04/05/2005 10:17  
 AMSubject 
   RE: initialize arrays   
   
   
   
   
   
   




[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:

: Are these two statements the same?
:
: my (@array, @array1) = ( );
:
: my @array = my @array1 = ( );

According to Data::Dumper the results are the same.

print Dumper [EMAIL PROTECTED], [EMAIL PROTECTED];


But then this has the same result.

my( @array, @array1 );


Why are you trying to initialize perl arrays?


Charles K. Clarkson
--
Mobile Homes Specialist
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





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




printing a filehandle to another file.

2005-03-23 Thread DBSMITH
Here is my code:

use strict; use warnings;

my $tpexports = qq(/usr/local/bin/ohiohealth/derek);
my $archivedexports = qq(/usr/local/log/9940exports.archived);

open (_, +$tpexports) || die could not open file:
$tpexports $!;
open (FOO, $archivedexports) || die could not open
file $!;
print FOO \n, $tpexports;

close _;
close FOO;


My goal is to append whats in derek to FOO.


or


print \n  derek ; cat derek  9940exports.archived;

thank you,

derek


Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams



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




Re: printing a filehandle to another file.

2005-03-23 Thread DBSMITH
Perl'ers nevermind... I had a brain fart.  I got it using a foreach
loop on the file.

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams




   
 Derek 
 Smith/Staff/OhioH 
 ealth  To 
   beginners@perl.org
 03/23/2005 04:52   cc 
 PM
   Subject 
   printing a filehandle to another
   file.   
   
   
   
   
   
   



Here is my code:

use strict; use warnings;

my $tpexports = qq(/usr/local/bin/ohiohealth/derek);
my $archivedexports = qq(/usr/local/log/9940exports.archived);

open (_, +$tpexports) || die could not open file:
$tpexports $!;
open (FOO, $archivedexports) || die could not open
file $!;
print FOO \n, $tpexports;

close _;
close FOO;


My goal is to append whats in derek to FOO.


or


print \n  derek ; cat derek  9940exports.archived;

thank you,

derek


Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams




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




logfile rotate used as a subroutine with file passed by reference

2005-03-12 Thread DBSMITH
All,
Please audit my code as I cannot figure out the correct method to pass by
ref into my logroll subroutine.

Here is the error I am getting :


Uncaught exception from user code:
error: can not lock open: ($_) at
/usr/local/bin/ohiohealth/tapesz_chk.OH.pl line 115
Carp::croak('error: can not lock open: ($_)') called at
/usr/perl5/site_perl/5.6.1/Logfile/Rotate.pm 3
Logfile::Rotate::new('Logfile::Rotate', 'File', '$_', 'Count', 10,
'Gzip', '/usr/bin/gzip', 'Dir', ..5
main::logroll('/usr/local/log/fuji_tapeszs.log') called at
/usr/local/bin/ohiohealth/tapesz_chk.OH.pl


###
## Set pragmas and modules (LC/UC) ##
###


use strict;
use warnings;
use diagnostics;
use MIME::Lite;
use Logfile::Rotate;

$ENV{PATH} = qq(/opt/SUNWsamfs/sbin:/usr/bin:/usr/sbin:/usr/local/log);

my $wd=40;
my $tpexports = qq(/usr/local/log/exports);
my $hrtlabtapeszs = qq(/usr/local/log/heartlab_tapeszs.log);
my $fujitapeszs = qq(/usr/local/log/fuji_tapeszs.log);
my $slhtapeszs = qq(/usr/local/log/slh_tapeszs.log);

open (_, +$tpexports) || die could not open file: $tpexports $!;
open (FFF_, +$hrtlabtapeszs) || die could not open file: $hrtlabtapeszs
$!;
open (FF_, +$fujitapeszs) || die could not open file: $fujitapeszs $!;
#open (F_, +$slhtapeszs) || die could not open file: $slhtapeszs $!;

system(archiver -lv|egrep 'sf.H02[0-9][0-9][0-9]'  $hrtlabtapeszs);
system(archiver -lv|egrep 'sf.F02[0-9][0-9][0-9]'  $fujitapeszs);
#system(archiver -lv|egrep 'sf.L02[0-9][0-9][0-9]'  $slhtapeszs);

select( (select(_), $|=1 ) [0] );
open (FFF_, +$hrtlabtapeszs) || die could not open file: $hrtlabtapeszs
$!;
open (FF_, +$fujitapeszs) || die could not open file: $fujitapeszs $!;
#open (F_, +$slhtapeszs) || die could not open file: $slhtapeszs $!;

system(archiver -lv|egrep 'sf.H02[0-9][0-9][0-9]'  $hrtlabtapeszs);
system(archiver -lv|egrep 'sf.F02[0-9][0-9][0-9]'  $fujitapeszs);
#system(archiver -lv|egrep 'sf.L02[0-9][0-9][0-9]'  $slhtapeszs);

select( (select(_), $|=1 ) [0] );
select( (select(FFF_), $|=1 ) [0] );
select( (select(FF_), $|=1 ) [0] );
#select( (select(F_), $|=1 ) [0] );

while (FFF_) {
if (substr($_, 52, 5) == 0 ){
chomp $_;
my $hvalustr=substr($_, 52, 5);
my $htpstr=substr($_, 2, 9);
system(samexport $htpstr);
   # logroll($hrtlabtapeszs);
print _ $htpstr\t$hvalustr\n;
}
}

while (FF_) {
if (substr($_, 52, 5) == 0 ){
chomp $_;
my $fvalustr=substr($_, 52, 5);
my $ftpstr=substr($_, 2, 9);
#system(samexport $ftpstr);
logroll($fujitapeszs.);
###- - -###  possible coding errors
print _ $ftpstr\t$fvalustr\n;
}
}

#while (F_) {
#   if (substr($_, 52, 5) == 0 ){
#   chomp $_;
#   my $svalustr=substr($_, 52, 5);
#   my $stpstr=substr($_, 2, 9);
#   system (samexport $stpstr);
#   logroll($slhtapeszs);
#   print _ $stpstr\t$svalustr\n;
#   }
#}

if ( -s $tpexports ) {
print _ \n,'-' x $wd, \n;
print _ TapeID\t  BytesRemaining\n\n;
print _ Please eject these as offsite
permanent!\nOhioHealth Unix Support;
#mailme;
#logroll;
}

sub mailme {
my $msg = MIME::Lite-new(
From= 'stkv440 xxx',
#To  = 'OHIS Operations x',
To  = 'Derek Smith ',
Subject = ASM Copy 2 exports,
Type= 'multipart/related');

$msg-attach(
Type= 'TEXT',
Path= $tpexports,
Filename = $tpexports);
$msg-send;
}

#foreach ($fujitapeszs,$hrtlabtapeszs,$tpexports,$slhtapeszs) {
#if ( -s $_ or -s $_ or -s $_ or -s $_ ) {
#foreach ($_) {

sub logroll {
my $logs = new Logfile::Rotate
(File = '$_',
  ###- - - ### possible coding error
Count = 10,
Gzip = '/usr/bin/gzip',
Dir  =
'/usr/local/log/old',
Flock = 'yes',
Persist = 'yes' );
$logs-rotate($_);
###- - -### 

print with +split

2005-03-11 Thread DBSMITH
All,

Here is my code:
use strict;
use warnings;
my $dev  = qw/original1/;
my $dev1 = qw/clinical1/;
my $fout = qq(/usr/local/log/fuji.out);

open (OUT, +$fout) || die unable to open file: $fout $!;
open (FOO, samcmd a $dev 2\1 | ) || die unable to open pipe...
$!;
while (FOO) {
 if (/regular files/ or /archdone files/) {
my $diff=0;
local $, = \n;
s/,//;
print +(split)[2], $,, $diff-=$1;
 }

and it prints w/out the $diff code

62622

62535

WITH the $diff code it is NOT subtracting the two numbers which is what I
need.

I think the problem is $_ contains data from the original app command which
is

regular files62,622597.488G  641547379187
archdone files   62,535597.008G  641032761295

and so I am saying subtract what is in field 1 , well field 1 is empty, but
why
finally, I took away the + from the print and I had some errors, why is the
+ infront of the split needed in Perl?

thank you,
derek

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams



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




RE: print with +split

2005-03-11 Thread DBSMITH
Wags,

come on you did not answer all my questions???  What about

I took away the + from the print and I had some errors, why is the +
infront of the split needed in Perl?
I looked in my programming perl and could not find it/.

The reason I want to use split is b/c these numbers change frequently and I
am guaranteed this field as opposed to using a substr the starting point
of $_ would be 25 and the length would fluctuate.

yes maybe I am not using split that way it should be, but If my delimiter
would be anything it would have to be everything between \w+ , field 3 or a
space.

I am trying to get the difference between these 2 numbers b/c in the ASM
env. regular files and archdone files should NEVER get larger that say
300.


Can you provide or anyone else provide any more hints?

thanks,


Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams




   
 Wagner, David
 --- Senior
 Programmer To 
 Analyst --- WGO  [EMAIL PROTECTED],   
 [EMAIL PROTECTED] beginners@perl.org
 ight.fedex.comcc 
   
 03/11/2005 04:25  Subject 
 PMRE: print with +split   
   
   
   
   
   
   




[EMAIL PROTECTED] wrote:
 All,

 Here is my code:
 use strict;
 use warnings;
 my $dev  = qw/original1/;
 my $dev1 = qw/clinical1/;
 my $fout = qq(/usr/local/log/fuji.out);

 open (OUT, +$fout) || die unable to open file: $fout $!;
 open (FOO, samcmd a $dev 2\1 | ) || die unable to open
 pipe... $!;
 while (FOO) {
  if (/regular files/ or /archdone files/) {
 my $diff=0;
 local $, = \n;
 s/,//;
 print +(split)[2], $,, $diff-=$1;
 I think you are mixing your metaphors. $1 is not field 1 , yes
in awk maybe, but for Perl it deals with the ()'s in a regular expression
so you would need the regular expression to accomplish your task.

Wags ;)
  }

 and it prints w/out the $diff code

 62622

 62535

 WITH the $diff code it is NOT subtracting the two numbers which is
 what I need.

 I think the problem is $_ contains data from the original app command
 which is

 regular files62,622597.488G  641547379187
 archdone files   62,535597.008G  641032761295

 and so I am saying subtract what is in field 1 , well field 1 is
 empty, but why
 finally, I took away the + from the print and I had some errors, why
 is the + infront of the split needed in Perl?

 thank you,
 derek

 Derek B. Smith
 OhioHealth IT
 UNIX / TSM / EDM Teams



***
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
***




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




RE: print with +split

2005-03-11 Thread DBSMITH
Yes Wags the end result is 87, but I want to just take these two numbers
and subtract then as opposed to using the * operator . I appreciate you
efforts, but there's got to be an easier and more closely related answer to
my original code with +(split)[2].

Does anyone know the answer to:

I took away the + from the print and I had some errors, why is the +
infront of the split needed in Perl?
I looked in my programming perl and could not find it.

thanks again dude,

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams




   
 Wagner, David
 --- Senior
 Programmer To 
 Analyst --- WGO  [EMAIL PROTECTED]
 [EMAIL PROTECTED]  cc 
 ight.fedex.com   beginners@perl.org
   Subject 
 03/11/2005 04:59  RE: print with +split   
 PM
   
   
   
   
   




[EMAIL PROTECTED] wrote:
 Wags,

 come on you did not answer all my questions???  What about
 I answered what I could. So is this what you want:
62622 62622
62535 87

where the code looks like:

#!perl

use strict;
use warnings;

my $diff=0;
my $MyMult = 1;
my $MyId;

while (DATA) {
 if ( /(regular files|archdone files)/ ) {
$MyId = $1;
$MyMult = 1;
$MyMult = -1 if ( $MyId =~ /^arch/ );

s/,//;

printf %s %s\n,
/\s(\d+)/,
$diff += $1 * $MyMult;
 }
 }

__DATA__
regular files62,622597.488G  641547379187
archdone files   62,535597.008G  641032761295

 Made minor changes, but is this what you are after?
Wags ;) ps I use printf and I really don't know the answer to + on the
split.  I do know that the $1 was wrong, but .


 I took away the + from the print and I had some errors, why is the +
 infront of the split needed in Perl?
 I looked in my programming perl and could not find it/.

 The reason I want to use split is b/c these numbers change frequently
 and I am guaranteed this field as opposed to using a substr the
 starting point of $_ would be 25 and the length would fluctuate.

 yes maybe I am not using split that way it should be, but If my
 delimiter would be anything it would have to be everything between
 \w+ , field 3 or a space.

 I am trying to get the difference between these 2 numbers b/c in the
 ASM env. regular files and archdone files should NEVER get larger
 that say 300.


 Can you provide or anyone else provide any more hints?

 thanks,


 Derek B. Smith
 OhioHealth IT
 UNIX / TSM / EDM Teams





  Wagner, David
  --- Senior
  Programmer
  To Analyst --- WGO  [EMAIL PROTECTED],
  [EMAIL PROTECTED] beginners@perl.org
  ight.fedex.com
 cc

  03/11/2005 04:25
  Subject PMRE: print with +split










 [EMAIL PROTECTED] wrote:
 All,

 Here is my code:
 use strict;
 use warnings;
 my $dev  = qw/original1/;
 my $dev1 = qw/clinical1/;
 my $fout = qq(/usr/local/log/fuji.out);

 open (OUT, +$fout) || die unable to open file: $fout $!;
 open (FOO, samcmd a $dev 2\1 | ) || die unable to open
 pipe... $!; while (FOO) {
  if (/regular files/ or /archdone files/) {
 my $diff=0; local $, = \n;
 s/,//;
 print +(split)[2], $,, $diff-=$1;
  I think you are mixing your metaphors. $1 is not field 1
 , yes in awk maybe, but for Perl it deals with the ()'s in a regular
 expression so you would need the regular expression to accomplish
 your task.

 Wags ;)
  }

 and it prints w/out the $diff code

 62622

 62535

 WITH the $diff code it is NOT subtracting the two numbers which is
 what I need.

 I think the problem is $_ contains data from the original app
 command which is

 regular files62,622597.488G  641547379187
 archdone files   62,535597.008G  641032761295

 and so I am saying subtract what is in field 1 , well field 1 is
 empty, but why finally, I took away the + from the print and I
 had some errors, why is the + infront of 

  1   2   3   >