Module for sending Fax

2002-04-17 Thread Robert Graham

Good day

Does anyone know of a perl module I can use to send a fax with?

Regards
Robert Graham


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Maximum ,Minumum

2002-03-27 Thread Robert Graham

Hi Ozgur

You can use the following:

@data = (10,45,2,439);
($min,$max) = (sort {$a = $b} @data)[0,$#data];

Regards
Robert

-Original Message-
From: OZGUR GENC [mailto:[EMAIL PROTECTED]]
Sent: 27 March 2002 13:06
To: [EMAIL PROTECTED]
Subject: Maximum ,Minumum


Hi All,
Does anyone help me about how I can find the maximum and minumum element
of an array?
Ozgur

***

This e-mail and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed.
If you are not the intended recipient you are hereby notified that any
dissemination, forwarding, copying or use of any of the information is
prohibited.

The opinions expressed in this message belong to sender alone. There is no
implied endorsement by TURKCELL.

This e-mail has been scanned for all known computer viruses.

***

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Maximum ,Minumum

2002-03-27 Thread Robert Graham

I see what you mean

I assume the following would be a better way of going at it

$max = $min = $data[0];
foreach $val (@data) {
$min = $val$min ? $val:$min;
$max = $val$max ? $val:$max;
}

Robert

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
Sudarsan Raghavan
Sent: 27 March 2002 14:26
Cc: [EMAIL PROTECTED]
Subject: Re: Maximum ,Minumum


Robert Graham wrote:

 Hi Ozgur

 You can use the following:

 @data = (10,45,2,439);
 ($min,$max) = (sort {$a = $b} @data)[0,$#data];

IMHO sorting a list to find the max and min element is not a good idea.
The sort is of O(nlgn) and the usual
run through the list to find the max element is O(n). This is not of
significance when n is small, at the same
time this is not a method that should be followed for this task.



 Regards
 Robert

 -Original Message-
 From: OZGUR GENC [mailto:[EMAIL PROTECTED]]
 Sent: 27 March 2002 13:06
 To: [EMAIL PROTECTED]
 Subject: Maximum ,Minumum

 Hi All,
 Does anyone help me about how I can find the maximum and minumum element
 of an array?
 Ozgur


***

 This e-mail and any files transmitted with it are confidential and
intended
 solely for the use of the individual or entity to whom they are addressed.
 If you are not the intended recipient you are hereby notified that any
 dissemination, forwarding, copying or use of any of the information is
 prohibited.

 The opinions expressed in this message belong to sender alone. There is no
 implied endorsement by TURKCELL.

 This e-mail has been scanned for all known computer viruses.


***

 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




PArsing a template file

2002-03-07 Thread Robert Graham

Hi there

I need to write a program that will parse a template file that looks
something like this:

THE FORECAST WAS ISSUED AT $today
SOME MORE TEXT...
..
..

What I want to do is to read the line and print it out with the value for
$today which will be set in the program.

Any help will be appreciated.

Regards
Robert Graham
South African Weather Service

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Adding quotes to a string variable

2002-01-07 Thread Robert Graham

You have two options:

Option one: Put the string between single quotes $a = 'Test Test Test';

Option two:  $a = q(Test Test Test);

Regards
Robert Graham

-Original Message-
From: Hubert Ian M. Tabug [mailto:[EMAIL PROTECTED]]
Sent: 07 January 2002 12:02
To: Perl
Subject: Adding quotes to a string variable


Hello,
   I have a variable say $a = Test Test Test whose contents when
printed out is Test Test Test. I want the said variable to have the quotes
appended, meaning
 it will print out Test Test Test and the variable will contain the quotes
as well. Is that possible? You help would be greatly appreciated.


Thanks



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: File System Sizes....

2001-11-27 Thread Robert Graham

You can try the following

($percent) = `df -k` =~ /(\d+)%/;

Regards
Robert Graham

-Original Message-
From: Kipp, James [mailto:[EMAIL PROTECTED]]
Sent: 27 November 2001 15:47
To: 'James Kelty'; [EMAIL PROTECTED]
Subject: RE: File System Sizes


 
 $percent = `df -k | awk '{print $5}'`;

 if($percent  90) {
 
 do something
 }
 
 I though that this would work, but I didn't get just the % 
 column from the
 awk statment. I am really trying
 to do this all in perl instead of mixing it with awk.

in that case all you need to do is capture the df -k output then regex it. 

$percent = `df -k`;
$percent =~/regex_to_capture_number/;

--
don't have time to look at the output right now and regex but should be
easy.

 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Off-Topic (200%) - Where are you from?

2001-11-12 Thread Robert Graham

Good morning from Pretoria, in sunny South Africa


 By reading the messages everyday I can guess most of us are from United
 States right? And since there are not a lot of messages in (my) morning
 time, probably means most are from the west coast (different timezone).

 Am I right?

 I'm from Quebec, Canada.. and you?

 Sorry if it's way off topic, I hope the ones that hate OT subject
 filtered *off*topic* in their  emails!

 Etienne




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Off-Topic (200%) - Where are you from?

2001-11-11 Thread Robert Graham

Good morning from Pretoria,in Sunny South Africa.

-Original Message-
From: Etienne Marcotte [mailto:[EMAIL PROTECTED]]
Sent: 09 November 2001 17:08
To: [EMAIL PROTECTED]
Subject: Off-Topic (200%) - Where are you from?


By reading the messages everyday I can guess most of us are from United
States right? And since there are not a lot of messages in (my) morning
time, probably means most are from the west coast (different timezone).

Am I right?

I'm from Quebec, Canada.. and you?

Sorry if it's way off topic, I hope the ones that hate OT subject
filtered *off*topic* in their  emails!

Etienne

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Regular expression help!!

2001-10-25 Thread Robert Graham

Hi

You can try the following:

$line = insert_job: DUKS_rtcf_daily_log_purge job_type: c;
($rest) = $line =~ m/(\W\w.*)/;


Regards
Robert

-Original Message-
From: Woz [mailto:[EMAIL PROTECTED]]
Sent: 25 October 2001 11:17
To: [EMAIL PROTECTED]
Subject: Regular expression help!!


Hi,
 
I'm relatively new to the wonders of Perl programming and I've yet to
quite get my head around regular expressions.
I'm attempting to generate a search and replace expression that will
turn the following string
 
insert_job: DUKS_rtcf_daily_log_purge job_type: c
 
into
 
DUKS_rtcf_daily_log_purge job_type: c
 
i.e. remove from the beginning of the line up the space following the
first :
All my efforts so far remove upto the second : though and leave just
'c'.
 
Any ideas?
 
Any help much appreciated!
 
Thanks,
 
Warren
 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Regular expression help!!

2001-10-25 Thread Robert Graham

You can use the following to remove the space in front
$Value =~ /s/^\s+//;
 
And for the sake of interest $Value =~ s/\s+$//; will remove any trailing
spaces from a string
 
Regards
Robert Graham

-Original Message-
From: Woz [mailto:[EMAIL PROTECTED]]
Sent: 25 October 2001 12:04
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: Regular expression help!!


Wow, that was fast!
 
Thanks very much, that works well.
For my next question (:-)) how can I make it strip the leading space that it
leaves on the resulting string. i.e. I want it to strip 'insert_job: ' from
the string - note the trailing space.
 
At the moment I have: -
 
  ($Value)=$_=~m/(\W\w\S.*)/; 
  ($Value)=$Value=~m/(\S.*)/;
 
but I'm sure there's a far more elegant solution that combines it all into
one.
 
Many many thanks for your help.
 
Warren
note to self - buy O'Reillys book on regular expressions!


-Original Message- 
From: Robert Graham 
Sent: Thu 25/10/2001 10:27 
To: Woz; [EMAIL PROTECTED] 
Cc: 
Subject: RE: Regular expression help!!



Hi 

You can try the following: 

$line = insert_job: DUKS_rtcf_daily_log_purge job_type: c; 
($rest) = $line =~ m/(\W\w.*)/; 


Regards 
Robert 

-Original Message- 
From: Woz [ mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] 
Sent: 25 October 2001 11:17 
To: [EMAIL PROTECTED] 
Subject: Regular expression help!! 


Hi, 
  
I'm relatively new to the wonders of Perl programming and I've yet to 
quite get my head around regular expressions. 
I'm attempting to generate a search and replace expression that will 
turn the following string 
  
insert_job: DUKS_rtcf_daily_log_purge job_type: c 
  
into 
  
DUKS_rtcf_daily_log_purge job_type: c 
  
i.e. remove from the beginning of the line up the space following the 
first : 
All my efforts so far remove upto the second : though and leave just 
'c'. 
  
Any ideas? 
  
Any help much appreciated! 
  
Thanks, 
  
Warren 
  




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: DBI question (again)

2001-08-02 Thread Robert Graham

Have a look a the Short Guide to DBI available at perl.com  It has an
example with queries.
http://www.perl.com/lpt/a/1999/10/DBI.html

Regards
Robert

- Original Message -
From: Elie De Brauwer [EMAIL PROTECTED]
To: Ray Barker [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, August 02, 2001 10:15 AM
Subject: Re: DBI question (again)


 snap

  good info on using the DBI module (should take you right to prepare):
  http://theoryx5.uwinnipeg.ca/CPAN/data/DBI/DBI.html#prepare
 
  There is also a good O'Reilly book titled Using the Perl DBI (or
  something like that) by Alligator Descartes
 

 I know of the existence of that book but the problem is, if i order that
book
 it would take abount one month to actually have it, and this project has
to
 be finished before that ... so i am really searching online material ...

  - is the dereference operator--the cookbook won't teach you much
  about it
 
  In your case, the $dbh = DBI... returns a database handle(=a
  reference to a database object in OO speak).
  Then the $dbh-do($SQL);   runs the do method of the $dbh object
 
  The code you've copied from the cookbook is a bit of nonsense meant
  as an example. To make it work you have to fill in the driver, the
  database name etc. in the DBI-connect call and you have to put a
  legal SQL statement in the $SQL variable.  This is covered in the
  above DBI documentation.  In my copy of the cookbook, example 14-7 is
  a more nearly working example, but you would still have to point it
  to your database.

 I know it is an example, as in i can make it work i type it in add the
driver
 add the query and it works perfectly but i'm not happy with that i want to
 know WHY is works and WHAT it does.

 I know but exemple 14-7 isn't a really query it's just an insert  i am
 more interested in query's 

 --
 ==
  real men do it in perl ;)

  De Brauwer Elie
[EMAIL PROTECTED]
 ==

 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Re:Net::Ping

2001-07-17 Thread Robert Graham

Hi Jorge

You can define the host name as a string eg.
$host = hostname;
where hostname represents the host name on your network,
and then refer to the string in the ping command:
unless ($p-ping($host))

Hope this helps
Robert Graham

 Hi I have the following code:

 use Net::Ping;
 $p = Net::Ping-new();
 unless ($p-ping(cu5s46))
 {
 require Tk::Dialog;
 $dialog =$mw- Dialog( -title = 'NETWORK ALERT BOX',
-text = THE NETWORK IS DOWN,
-font = Arial 16 normal,
-justify = 'center',
-default_button = 'OK',
-bitmap ='error',
-buttons = [qw/OK/] );


 $dialog-Show;
 }


 $p-close;


 But I would like to put a variable instead of cu5s46, a variable which
could
 represent some host name in my network.

 How can i do this?Thanks

 - End Forwarded Message -



 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: /g

2001-06-25 Thread Robert Graham

Sally

The /g does a global match.  In other words it finds all occurences of the
pattern.

Kind regards
Robert Graham
[EMAIL PROTECTED]
Tel: (012) 309 3075
Fax: (012) 323 4518
South African Weather Bureau
*
Call our Weatherline at: 082 162
Visit our web site at : www.weathersa.co.za


- Original Message -
From: Sally [EMAIL PROTECTED]
To: perl [EMAIL PROTECTED]
Sent: Monday, June 25, 2001 12:11 PM
Subject: /g


 when evaluating strings what exactly does /g do at the end of a lot of
 evaluation expressions eg:

 $string =~ /(.)/g

 Is it some sort of end or finish statement? I've seen it used loads but no
 book explains it.

 Thanks,

 Sally

 ps. I do know what the above expression does, I'm only concerned with the
 explicit meaning of /g