Re: use strict, How to 'globalised' variable within loops. (was => Re: Question!! number of line....)

2001-12-29 Thread Michael R. Wolf

"Leon" <[EMAIL PROTECTED]> writes:


[...]

> (1)how to make a variable within loops non-lexical as in this eg:-
> while (){
>  my $count++; # how to globalised this variable?
   $count++;  # NO "my", therefore implicitly global.
> };

> 
> (2)how to make a variable available to all parts of this while loop
> ONLY eg:-
> use strict;
> while (){
^ $count scope starts here
>  my $count++;
>  if (1){
> #what must I do to return $count here.
you probably don't mean "return", but merely "access"
> $count_available_here_also = $count;
This is it!!!  You did it.  It's accessable here.

$count is lexically scoped to the enclosing braces, and all
subordinate scopes.

   V $count scope ends here
>  };
> };
> #I do not wish to return $count here..
Add a set of braces.  See example below
> $but_not_here = $count; 


print "not accessable\n" unless defined $loop_count;
{
my $loop_count;
print "not accessable\n" unless defined $loop_count;

while () {
$loop_count++;
print "$loop_count\n";
if (localtime % 2) {
print "$loop_count at 'random' times\n";
}
}

print "Loop exited having exicuted $loop_count times.\n";
}
print "not accessable\n" unless defined $loop_count;

It does what you'd expect.  The "my" variable isn't
accessable before or after the loop.  (Actually, *another*
one *is*.  There are actually two $loop_count variables.
One that we use inside the braces, and only in the braces.
The other one (that we really don't use) is at a higher
scope.  Even though it's spelled the same, it's a different
variable.

Here's a good little example.  It remembers the scalar
between invocations, but doesn't allow it to be accessable
outside the blocck that encloses the subroutine.

{
my $serial_num = 100_000;
sub serial_num {
return $serial_num;
}
}

foreach (20..30) {
printf "Next up: %d\n", serial_num();
}



-- 
Michael R. Wolf
All mammals learn by playing!
   [EMAIL PROTECTED]


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




Re: help on how to split a string

2001-12-29 Thread Michael R. Wolf

"Peter Cornelius" <[EMAIL PROTECTED]> writes:

> @val = m/".*?",?/g;  # m//g in list context returns all matches
> #   list gets all matches of things that begin with a double quote
> # followed by any character zero or more times matching the
> # minimal amount before finding a double quote followed by zero
> # or more commas.

Watch out.  This *requires* that all data have double quotes
around it.  Some data only had double quotes around it if it
*needs* to have them, like if it's got embedded commas.
Check your data carefully.  You may be able to get away with
this RE.  Luck you if you can.  If not, you have to use one
of the CSV splitting modules.  The first line works, the
second one doesn't.

"a", "bcd, efg, h", "c"
a,"bcd, efg, h",c


-- 
Michael R. Wolf
All mammals learn by playing!
   [EMAIL PROTECTED]


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




use strict, How to 'globalised' variable within loops. (was => Re: Question!! number of line....)

2001-12-29 Thread Leon

- Original Message -
From: "John W. Krahn" <[EMAIL PROTECTED]>

> Leon wrote:
> >
> > - Original Message -
> > From: "Mark Mclogan" <[EMAIL PROTECTED]>
> > > How I can know in that I number of line finds a word in a text file?.
> > > For example, a file "file.txt" contains the following list:
> > > Chocolate
> > > Cake
> > > Cheese
> > > Apple
> > > How I can know in that line number is the Apple word?
> >
> > open FILE, 'file.txt' or die "$!\n";
> > while (){
> > chomp;
> > my $count++;
>
> $count is lexically scoped to the while loop so it will always have a
> value of one.

Thanks John for pointing out my mistakes otherwise I would still be in the
dark. I was wrong when I thought that the variable $count within the while
loop is avaliable to all parts of this while loop such as this :-
while (){
 chomp;
 my $count++;
 if ( 1 ) {print "Line number $count\n"} ; #I was wrong!
};

I apologise to members for my unintentional mistake.

Using strict; apart from defining "my variable" in the main body of the
script, could some member tell me :-
(1)how to make a variable within loops non-lexical as in this eg:-
while (){
 my $count++; # how to globalised this variable?
};

(2)how to make a variable available to all parts of this while loop
ONLY eg:-
use strict;
while (){
 my $count++;
 if (1){
#what must I do to return $count here.
$count_available_here_also = $count;
 };
};
#I do not wish to return $count here..
$but_not_here = $count; 

Thanks

--- The correction of my untested failed script 
--- Tested and working 

open FILE, 'file.txt' or die "$!\n";
my ($count);
while (){
chomp;
$count++;
print "Apple is found in line number $count\n" if (/Apple/);
};
close FILE;






_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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




open URL as stream with LWP?

2001-12-29 Thread Steven Bach

Is there a way to open a URL with LWP so that it becomes something like 
a filehandle so that I can do a "while ()" on it?  This would be 
really handy, but I can't sort out how to do it.

The code I am working on originally opened a file, and used a filehandle 
to do its thing.  Replacing the filehandle would keep things so simple. 
  I can already opening a pipe to wget or curl, which is what I am 
doing, but I would like to use LWP so that things would be more portable.

Thanks,
Steven Bach


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




Perl:readina doc file and adding a gif

2001-12-29 Thread Nestor Florez

I am trying to figure out how to insert a gif file in the middle of a word
file(.doc).
I am asking here, becasue I thought maybe someone has come acrss this
before.

I can read the doc file and create it as a different file and word will
read, but if
I try inserting someting into the file, then word can not read it.

Does anyone know the format or the correct way to insert a gif file in
middle of a
microsoft word file(.doc)

I can read the word file using something like:
while(read(FILE, $buf, $len))
{
  #Here when ever I find a key word I open the gif file, read and insert
  #a print statement intothe OUT file handle
  if($_ =~ /nestor/)
 {
while(read(GIF, $buf2, $len))
{
   print OUT $gif;
}
  }
   print OUT $_;
}

When I look at the size of the new file, I can tell that tne input file and
the GIF file are all one file but word does nto recognize the document.
There must be some word format saying at this point
display the gif file, kind of like in an HTML file you would have an
 tag.

How big do you have to set the $len scalar? I set it to 1024 currently.

Can anyone give me any hints for the proper format to insert a gif file into
a word file.

Thanks,

Nestor



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




RE: help on how to split a string

2001-12-29 Thread Peter Cornelius

To get the output you want from the input you listed, you probably don't
want to use split().  Take a look at the m// construct.

use strict;  #Always use strict and warnings
use warnings;

my @val; #declare myself an array.

while () { # DATA is a special file handle that reads from the
 # END of the program text

@val = m/".*?",?/g;  # m//g in list context returns all matches
#   list gets all matches of things that begin with a double quote
# followed by any character zero or more times matching the
# minimal amount before finding a double quote followed by zero
# or more commas.

}

print "<<$_>>" for @val;
print "\n";

__END__
"a", "bcd, efg, h", "c"


perldoc perlre has more.

Peter C.

-Original Message-

I have a text files to analyze.   Each line looks like : "a", "bcd, efg, h",
"c"

I found that $l=readline($filehandle) gives me the content of the current
line.

Now, how can I explode the line. I'd like:
$val[0]="a", $val[1]="bcd, efg, h", $val[2]="c" (or equivalent).

I cannot figure out how to use split when the delimiter is the double quote.

Thanks for your help.

Jean-Louis



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




Re: Question!! number of line....

2001-12-29 Thread Simon K. Chan

Hiya Mark,

Something like this should work:

#!/usr/local/bin/perl -w

use strict;

my $file = "file.txt";

open (READ, "<$file") || die "Can\'t open file: $!";

my @list_of_words = ;

close (READ) || die "Can\'t close file: $!";

my $counter = 1;

foreach my $word (@list_of_words){

++$counter;

if ($word eq "Apple"){

my $counter2 = $counter;
last;

} 

}

print "Found \'Apple\' in line $counter2";

exit;

### Each cycle in the foreach loop increases the value of $counter by 1.  When the 
word is
located, the loop exited due to the "last" command. So, if the word is in line number 
5, $counter
will have a value of 5.

I hope this helps.
Simon

##

--- Mark Mclogan <[EMAIL PROTECTED]> wrote:
> 
> How I can know in that I number of line finds a word in a text file?.
> For example, a file "file.txt" contains the following list:
> 
> Chocolate
> Cake
> Cheese
> Apple
> orange
> melon
> lemon
> 
> How I can know in that line number is the Apple word?
> 
> Over
> 
> MMClogan
> 
> 
> _
> MSN Photos is the easiest way to share and print your photos: 
> http://photos.msn.com/support/worldwide.aspx
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


=
#
Warmest Regards,
Simon K. Chan - [EMAIL PROTECTED]

"Great spirits have always encountered violent opposition from mediocre minds."

-Albert Einstein

__
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com

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




Re: help on how to split a string

2001-12-29 Thread John W. Krahn

"Jonathan e. paton" wrote:
> 
> Jean-Louis wrote:
> >
> > Now, how can I explode the line. I'd like:
> > $val[0]="a", $val[1]="bcd, efg, h", $val[2]="c" (or
> > equivalent).
> 
> C4 or TNT?

Or if you are a DIY kind of guy just mix together some potassium
nitrate, sulfer, and charcoal.

:-)

John
-- 
use Perl;
program
fulfillment

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




Re: help on how to split a string

2001-12-29 Thread Jonathan E. Paton

> > I cannot figure out how to use split when the delimiter
> > is the double quote.
> 
> @var = split /\"/, $line;

I am of course wrong, you need something more akin to:

@var = split /\".*?\"/, $line;

but as Michael says this isn't the best way to solve the
problem... unless you are looking for the quick and dirty
solution.

Jonathan Paton

__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

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




Re: help on how to split a string

2001-12-29 Thread Michael R. Wolf

To: "Jean-Louis" <[EMAIL PROTECTED]>
Subject: Re: help on how to split a string
References: <003701c1909a$e125aab0$74d2fea9@JEANLOUIS>
--text follows this line--
"Jean-Louis" <[EMAIL PROTECTED]> writes:
> I found that $l=readline($filehandle) gives me the content of the current line.
Use these instead.

$line = ;
chomp $line;

  or

$line = <>;
chomp $line;

> Now, how can I explode the line. I'd like:
> $val[0]="a", $val[1]="bcd, efg, h", $val[2]="c" (or equivalent).
> 
> I cannot figure out how to use split when the delimiter is the double quote.

Don't use split for CSV fields that may (or may not) have
quotes.  Although it may be tempting to use RE's, it's a lot
harder than it may initially look.  There's all kinds of
special cases - backslashes preceeding a character, quotes
within quotes, ...

Try these modules from CPAN

http://search.cpan.org/doc/HALPOM/Text-ParseWords-3.1/ParseWords.pm
http://search.cpan.org/doc/ALANCITT/Text-CSV-0.01/CSV.pm

I haven't used them, but I'm guessing that this will work:

use Text::ParseWords;

$line = '"a", "bcd, efg, h", "c"';
@words = parse_line(",", 0, $line);
foreach (@words) {
  printf "%d. <%s>\n", $index++, $_;
}

Should print:
1. 
2. 
3. 


-- 
Michael R. Wolf
All mammals learn by playing!
   [EMAIL PROTECTED]


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




RE: Good CS Literature

2001-12-29 Thread Peter Cornelius

I just wanted to put in a shout for one of my favorite, and unmentioned,
Perl books.  "Effective Perl Programming" is by Joseph Hall and Randal
Schwartz.  It addresses many of 'am I doing it right' questions.  The "Perl
Cook Book' that others have mentioned is also a good reference for this.
I've found that it usually has, at least, something very close to the
problem I'm trying to solve and can put you on the right track.

One last general book you might look at is "Code Complete." I've never read
this book, though I'm taking my B&N gift certificate and buying it today.
In other threads like this I've seen its name comes up and it seems to be
well respected.

Good Luck,
Peter C.

-Original Message-


Thanks guys/gals for all your replies... Yes, im focusing on Perl right
now and maybe Java. I bought the Learning Perl by Orielly but I returned
it after realizing thats its almost the same as perldoc/manuals... My
problem with programming is that i dont know if im doing the right
thing... Yes the program/script works but Im not sure if its effecient
or not...


thnx alot


luke




--
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: help on how to split a string

2001-12-29 Thread Jonathan E. Paton

> I'm just starting Perl, since... a few hours ago...

You'll be interested in:

www.perl.com
www.perl.org
www.perldoc.com

> 
> I have a text files to analyze.   Each line looks like :
> "a", "bcd, efg, h", "c"
> 
> I found that $l=readline($filehandle) gives me the
> content of the current line.

$line = <$filehandle>

is a little clearer.  Readline is rarely used, AFAIK.

> Now, how can I explode the line. I'd like:
> $val[0]="a", $val[1]="bcd, efg, h", $val[2]="c" (or
> equivalent).

C4 or TNT?

> 
> I cannot figure out how to use split when the delimiter
> is the double quote.

@var = split /\"/, $line;

Jonathan Paton

__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

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




Re: Subject line suggestion for "newbies"

2001-12-29 Thread Michael R. Wolf

"Eric S. Harris" <[EMAIL PROTECTED]> writes:

> To my fellow Perl "newbies":
> 
> You might want to consider using a more meaningful subject line than something
> like these, all culled from the last month:
> o beginner question
> o Can any one see an error in here I can't?
> o Hello. How can I fix this line of code?
> o hello!! please help me!!
> o Help needed

[...]

> Such subject lines aren't much help.

It may be helpful for you to also know that many experienced
readers of these kinds of groups skip over postings with
poor subjects.  We want to help, but figure that there's
only so much time to do so.  We focus on the ones that seem
to have a grasp of what they do and do not know, and can
articulate it well in the body *and* the subject.

When I see a subject like "I need help", my answer
(privately to myself) is "You sure do.  And it involves
collecting your thoughts in a focused request."

Sorry if this sounds harsh, but it is meant as a help.  It's
the reality of what happens here.  Folks that know what's up
are more inclined to help others that have done their
homework.  That includes:
*specific* subject
well described background
sample data (input and output)
edge definitions (what works, what doesn't)
all this distilled/whittled down to the minimal set
   that defines the issue


Do yourself a favor by doing your reader a favor.  Make it
easy for the reader to understand your problem, and you make
it easier for them to help you and answer your problem.

And "newbie" is such a weak term.  It reeks of "I'm weak".
Be strong.  State what you *do* know.  State that you are
aware of what you are missing, or at least know what
direction it is.  People like helping people that are
helping themselves.  Don't put up a post that reeks of "I'm
helpless".  We all started out at "ignorant" and are still
there on some subject; "ignorant" merely means not knowing.
But "stupid" or "weak" doesn't work.

-- 
Michael R. Wolf
All mammals learn by playing!
   [EMAIL PROTECTED]


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




reinventing "The Book" [ was: Good CS Literature

2001-12-29 Thread Michael R. Wolf

"jeff" <[EMAIL PROTECTED]> writes:

> I admire your philosophy!  I purchased Learning Perl on
> win32 Systems by Schwartz, Olson & Christiansen read and
> worked the exercises and use it daily but now at a point
> where I want more.

Luckey for you, there is more.  Someone anticipated your
need.

http://www.oreilly.com/catalog/pperl3/

Then click "Add to Shopping Cart"

> I want to get a hard copy of the perl reference, but not
> sure what and how to print it out.

[...]

IMHO -- don't reinvent "The Book".  There were two great
people who made Perl be so useful:

  Perl language   Larry Wall
  Perl documentation  Tim O'Reilly

Without the great documentation, I don't think Perl would
have gone as far as it has.  I really think that the
O'Reilly books are great.  Good content (thanks to great
authors), good organization (thanks to great editors),
fun/educational/useful (thanks to Tim & staff).  They hold
together very well -- the bindings are more expensive than
they need to because they work better than most bindings.
That means that the book can be held open without breaking
its back, despite many years of abuse.  Buy one.  Mark the
everlovin' daylights out of it.  Nick the pages, write on
the binding, hilight the index, scribble all over the back
pages, make marks from one section to another.  (I often go
the "wrong" section, only to find my hand written note to
got the "correct" section, including page number).

Maybe I'm missing your point, but I have found that the book
is very useful, especially after I customize it.  And it
lays on my desk better than any sheaf of papers ever would.
ANd it has an index.  And it was designed to go together...

But if you want to have hard copy of the executable output
from perldoc, perhaps you will endure the paper copies
flying all around your desk.  Work styles vary.  I like the
bulk of my learning to come from the book.  I use perldoc
very infrequently to find the particular syntax of something
that I vaguely remember.  I use it less now that I have the
Perl CD, since it's searchable.  But I still use the paper
books, and would not substitute the CD for the paper.  They
complement each other very well.

-- 
Michael R. Wolf
All mammals learn by playing!
   [EMAIL PROTECTED]


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




Q's bout daemon from perl newbie

2001-12-29 Thread mas Tri

I have searched this topic from achive but not found yet...

I make a perl daemon script

>From console, my script detach itself using Proc::Daemon::Init (use
Proc::Daemon module I installed from CPAN).

in background, my process looping forever to check some condition saved
in database.

when this looping meet some particular condition (lets say $Salary >
USD 100 annual:), this script will fork to execute some sub
procedure. This script use Proc::Simple to fork, and execute another
sub procedure as an independent process

in this procedure (called by Proc::Simple->start), my script must
execute external program. I use system(externalprogram) to execute it. 

*when* I comment Proc::Daemon::Init line and let my script run at fore
ground but sub procedure called by Proc::Simple, everything seems ok.
*but*, when I push my script to back ground by uncomment
Proc::Daemon::Init line, my external program I call using system is
*not executed*

I have try to replace Proc::Daemon::Init by manual forking:

use POSIX;
$pid = fork;
exit if $pid;
setsid;
#close STDIN,STDOUT,STDERR
...rest of my script

but this replacement not solve this problem yet

would anyone here gimme a clue what's going on ?

thx,

Tri
 



=
.love is never enough to be everything

__
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com

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




Re: Question!! number of line....

2001-12-29 Thread Connie Chan

Oops.. I made some mistake, sorry =)
should be like this :

###
open (FILE, ") 
{
@lineNumber = (@lineNumber, $count) if ($_ eq "apple\n") ;
$count++;
}
close (FILE);
###

PS. if you have only 1 apple, then it valued at $lineNumber[0];

have a nice day =)


- Original Message - 
From: "Mark Mclogan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, December 29, 2001 5:36 AM
Subject: Question!! number of line


> 
> How I can know in that I number of line finds a word in a text file?.
> For example, a file "file.txt" contains the following list:
> 
> Chocolate
> Cake
> Cheese
> Apple
> orange
> melon
> lemon
> 
> How I can know in that line number is the Apple word?
> 
> Over
> 
> MMClogan
> 
> 
> _
> MSN Photos is the easiest way to share and print your photos: 
> http://photos.msn.com/support/worldwide.aspx
> 
> 
> -- 
> 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: Question!! number of line....

2001-12-29 Thread Connie Chan

open (FILE, ") {  if ($_ eq "apple\n") { $count++ } }
close (FILE);

you got the result at $count

have a nice day =)


- Original Message - 
From: "Mark Mclogan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, December 29, 2001 5:36 AM
Subject: Question!! number of line


> 
> How I can know in that I number of line finds a word in a text file?.
> For example, a file "file.txt" contains the following list:
> 
> Chocolate
> Cake
> Cheese
> Apple
> orange
> melon
> lemon
> 
> How I can know in that line number is the Apple word?
> 
> Over
> 
> MMClogan
> 
> 
> _
> MSN Photos is the easiest way to share and print your photos: 
> http://photos.msn.com/support/worldwide.aspx
> 
> 
> -- 
> 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]




help on how to split a string

2001-12-29 Thread Jean-Louis

Hi to all!

I'm just starting Perl, since... a few hours ago...

I have a text files to analyze.   Each line looks like : "a", "bcd, efg, h", "c"

I found that $l=readline($filehandle) gives me the content of the current line.

Now, how can I explode the line. I'd like:
$val[0]="a", $val[1]="bcd, efg, h", $val[2]="c" (or equivalent).

I cannot figure out how to use split when the delimiter is the double quote.

Thanks for your help.

Jean-Louis 




Re: CTLib error catching

2001-12-29 Thread gmsayloriii

here is a small example of two call back functions and their use, please
also see the module's documentation at CPAN.org,
as well as Michael Peppler's site for more in depth information
http://mbay.net/~mpeppler/Sybperl/article.html.

You will likely want much more in depth error management than this but for a
start...

#!/usr/bin/perl -w

use strict;
use Sybase::CTlib;


#---SNIP#

#
# Callbacks for CT Lib messages
#
sub ClientCallBack()
{
  my ($M_HNDL_LAYER,
$M_HNDL_ORIGIN,
$M_HNDL_SEVERITY,
$M_HNDL_NUMBER,
$M_HNDL_MESSAGE,
$M_HNDL_OSMESSAGE,
$M_HNDL_DBHANDLE) = @_;

if($M_HNDL_SEVERITY > 10)
{
print STDERR "ERROR: $M_HNDL_NUMBER, MESSAGE: $M_HNDL_MESSAGE\n";
}
CS_SUCCEED;
}

sub ServerCallBack
{
my($S_HNDL_DBHANDLE,
$S_HNDL_NUMBER,
$S_HNDL_SEVERITY,
$S_HNDL_STATE,
$S_HNDL_LINE,
$S_HNDL_SERVER,
$S_HNDL_PROC,
$S_HNDL_MESSAGE) = @_;

if($S_HNDL_SEVERITY > 10)
{
print STDERR "ERROR:  $S_HNDL_NUMBER, MESSAGE: $S_HNDL_MESSAGE\n";
}
CS_SUCCEED;
}

#
#  Usage example:
#

sub CheckStorage
{

my ($SERVER,$DATABASE) = @_;

ct_callback(CS_CLIENTMSG_CB, \&ClientCallBack);
ct_callback(CS_SERVERMSG_CB, "ServerCallBack");

my $CONNECTION = Connect($SERVER);

$CONNECTION->ct_sql("exec dbccdb..sp_dbcc_deletehistory");
$CONNECTION->ct_sql("dbcc checkstorage($DATABASE)");
}


sub Connect()
{
my ($SERVER) = @_;
my $PASSWORD = sorryCharlie;
my $USERID = 'sa';

my $dbHandle = Sybase::CTlib->ct_connect($USERID , $PASSWORD ,$SERVER);

return($dbHandle);
}

sub RunCheck
{
my ($SERVER,$DATABASE ) = @_;
chomp($SERVER);
chomp($DATABASE);
CheckStorage($SERVER,$DATABASE);
}

RunCheck('jupiter','dba');

###END###

HTH,
George

"Kanchana Weerasinghe" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm using CTLib to perform queries on sybase database.
>
> How do I catch errors such as database intergrity constraints etc?
> Thanks in advance.
>
>



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




Re: child processes and environment variables

2001-12-29 Thread Paul Johnson

On Fri, Dec 28, 2001 at 12:20:16PM -0500, Maciejewski, Thomas wrote:

> I am having an issue when spawning a child 

I understand that this is not uncommon and should not cause undue concern.

> it appears that the environment variable is not being passed to the child
> process here is the code:

Which one, $PATH?

> my $kidpid = open($fh, "-|");
> if (! $kidpid) {
> open(STDERR, "> /dev/null"); # rlog may complain; ignore.
> exec("rlog","-r", @files);
> }
> 
> if I hard code the path to rlog everything works fine ... 
> also I printed out the path and it seems that the parent has the correct
> path to rlog

What about the child?

> any ideas?

Everything works fine for me.  The child inherits the parent's environment
as it should.  You'll need to provide a working (failing) code section I
think.

Best wishes to you and your offspring.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

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




RE: Automatic execute of script

2001-12-29 Thread jeff

Thanks for all the help on my question.  I picked the solution to
periodically request a web page on a daily basis (using my browser) to
execute my perl script.  Although the "sleep x" worked great I think I will
have problems because our business host server goes down for periodic
maintenance.  I think this would stop execution of the script.  The cron is
not allowed by our business host account and autosys costs money.  I am
still investigating the AT command.  Thanks again!!

Jeff



-Original Message-
From: Chris Spurgeon [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 28, 2001 1:32 PM
To: 'Tom Bartos'; jeff; Beginners
Subject: RE: Automatic execute of script


You can sometimes get at it from the client side...if you can set up
something on a machine that you control to periodically request a webpage
from the server, and if that web page runs the perl script you want to fire,
you can accomplish the same thing that way.


Chris Spurgeon
Senior Design Technologist
[EMAIL PROTECTED]

ELECTRONIC INK
One South Broad Street
19th Floor
Philadelphia, PA 19107
www.electronicink.com

t 215.922.3800 x(233)
f 215.922.3880


-Original Message-
From: Tom Bartos [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 28, 2001 12:55 PM
To: jeff; Beginners
Subject: Re: Automatic execute of script


the AT command works a lot like cron, see if you can use the AT command

- Original Message -
From: "jeff" <[EMAIL PROTECTED]>
To: "Beginners" <[EMAIL PROTECTED]>
Sent: Friday, December 28, 2001 9:37 AM
Subject: RE: Automatic execute of script


> Our business hosting service does not allow cron, they recommend checking
> with a third party.  I write the scripts on a windows machine and upload
> them to the apache Unix server to test and execute them.  Do you know of
any
> perl modules that self execute?
>
> -Original Message-
> From: Jeff Liu [mailto:[EMAIL PROTECTED]]
> Sent: Friday, December 28, 2001 11:45 AM
> To: jeff; Beginners
> Subject: RE: Automatic execute of script
>
>
>
> If you are using Unix, add your script in /etc/crontab like this.
>
> 0 3 * * * root /usr/local/bin/your-script
>
> 0 means run at minute 0.
> 3 means run at 3:00a.m.
> * means every day
>
> Jeff Liu
>
>
> -Original Message-
> From: jeff [mailto:[EMAIL PROTECTED]]
> Sent: December 28, 2001 11:41 AM
> To: Beginners
> Subject: Automatic execute of script
>
>
> Does anyone know how to get a script to execute at a predefined time
without
> user interaction.  I would like to monitor my sys clock and have the perl
> script execute.  Thanks
>
> Jeff
>
>
> --
> 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]
This e-mail is intended solely for the above-mentioned recipient and it may
contain confidential or privileged information.  If you have received it in
error, please notify us immediately and delete the e-mail.  You must not
copy, distribute, disclose or take any action in reliance on it.  In
addition, the contents of an attachment to this e-mail may contain software
viruses which could damage your own computer system.  While Electronic Ink,
Inc. has taken every reasonable precaution to minimize this risk, we cannot
accept liability for any damage which you sustain as a result of software
viruses.  You should perform your own virus checks before opening the
attachment.

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




Access Question!

2001-12-29 Thread Dan Hoggard

Can anyone tell me how I can access a banner rotation script from within
another
script.

My replicator creates html page in this form:
http://www.yourdomain.com/test/s.cgi?index-1001
I want my rotator script to rotate thew banners at the top of these pages.

I thank you for any help you can give me.

Thanks and God Bless
Dan Hoggard



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




Re: Subject line suggestion for "newbies"

2001-12-29 Thread Maurice Reeves

Agreed Eric.
The more descriptive your subject lines are, the more quickly you are able to get help 
and
the more inclined everyone is to help.

Also, as Eric suggested, it will make it easier for newbies to come in later and read 
the
emails and find solutions to a similar problem they are having.

A good article that bears reading from another Eric S. :) is here:
http://www.tuxedo.org/~esr/faqs/smart-questions.html

Cheers,
Maurice
- Original Message -
From: Eric S. Harris
Sent: Saturday, December 29, 2001 8:57 AM
Cc: [EMAIL PROTECTED]
Subject: Subject line suggestion for "newbies"

To my fellow Perl "newbies":

You might want to consider using a more meaningful subject line than something
like these, all culled from the last month:
o beginner question
o Can any one see an error in here I can't?
o Hello. How can I fix this line of code?
o hello!! please help me!!
o Help needed
o Help reqd.
o Help with Perl
o Help, I am new to Perl
o I need Help
o I need your help
o Newbie question...
o please take a look
o Question
o Question,
o question
o what am I doing?
o What is better


Such subject lines aren't much help.

After all, if the subject line doesn't begin with "Re:" it's pretty clear you
have a question.  (... rather than an answer.  Though it might be a rant/plea,
like this message.)  And it's probably from a beginner/newbie.  After all, if
you're posting it here makes it pretty clear you're a "newbie".

Those with the same or similar questions -- on hashes or regexes or whatever --
won't know to read the answers, either.  That doesn't help them.

Plus, reading the subject line won't reveal the subject of your question -- be
it hashes or whatever -- those with the ability and interest in it.  They may
skip it.  That doesn't help them notice your question so they can apply their
special expertise or interest.

Which that doesn't help you, either.   -Eric S.

P.S.  I almost included "loopy question" in the list of unhelpful subject lines,
but thought better of it.  And was glad I did, after looking at the body of the
message.  (It was a question about while loops.)

Did you read "renaming files - fatuous newbie query" from James Alexander
McCarney?  It was perfect.  I should be so witty and clear.   -ESH

P.P.S.  Another suggestion: if you happen to notice a message with the subject
"Weekly list FAQ posting" from casey at geeknest.com, you might want to read it.

I finally did.  It put hair on my chest, a song in my heart and improved my gas
mileage 200%.  It also contains helpful information and suggestions.  Even about
choice of subject lines.   -ESH

--
E-mail privacy:  http://www.curleywolfe.net/cw/E_Privacy.shtml (Perhaps a bit
over-cautious, she is.  Perhaps.)

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] more from the Web.  FREE 
MSN Explorer download : http://explorer.msn.com



Subject line suggestion for "newbies"

2001-12-29 Thread Eric S. Harris

To my fellow Perl "newbies":

You might want to consider using a more meaningful subject line than something
like these, all culled from the last month:
o beginner question
o Can any one see an error in here I can't?
o Hello. How can I fix this line of code?
o hello!! please help me!!
o Help needed
o Help reqd.
o Help with Perl
o Help, I am new to Perl
o I need Help
o I need your help
o Newbie question...
o please take a look
o Question
o Question,
o question
o what am I doing?
o What is better
 

Such subject lines aren't much help.

After all, if the subject line doesn't begin with "Re:" it's pretty clear you
have a question.  (... rather than an answer.  Though it might be a rant/plea,
like this message.)  And it's probably from a beginner/newbie.  After all, if
you're posting it here makes it pretty clear you're a "newbie".

Those with the same or similar questions -- on hashes or regexes or whatever --
won't know to read the answers, either.  That doesn't help them.

Plus, reading the subject line won't reveal the subject of your question -- be
it hashes or whatever -- those with the ability and interest in it.  They may
skip it.  That doesn't help them notice your question so they can apply their
special expertise or interest.

Which that doesn't help you, either.   -Eric S.

P.S.  I almost included "loopy question" in the list of unhelpful subject lines,
but thought better of it.  And was glad I did, after looking at the body of the
message.  (It was a question about while loops.)

Did you read "renaming files - fatuous newbie query" from James Alexander
McCarney?  It was perfect.  I should be so witty and clear.   -ESH

P.P.S.  Another suggestion: if you happen to notice a message with the subject
"Weekly list FAQ posting" from casey at geeknest.com, you might want to read it.

I finally did.  It put hair on my chest, a song in my heart and improved my gas
mileage 200%.  It also contains helpful information and suggestions.  Even about
choice of subject lines.   -ESH

-- 
E-mail privacy:  http://www.curleywolfe.net/cw/E_Privacy.shtml (Perhaps a bit
over-cautious, she is.  Perhaps.)

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




RE: Good CS Literature

2001-12-29 Thread Gary Hawkins

Question strikes me as a great idea Jeff.

Well I'm still afflicted by the awful leperous backtick habit so this might not
be right but it was fast, and the result sure looks like a duck.

Cheers,

/g

#!perl.exe -w

# Collect perldoc results into a single file.
# Keys in on '^=' to determine if documentation is available.
# Result available at http://www.eskimo.com/~ghawk/perldocs.txt
# This was on Windows.  Obviously, adjust per system.

@files = `dir /s /b D:\\PERL\\*`;

chomp @files;

foreach $file (@files) {
$fileoriginal = $file;
$file =~ s#\\##g;
next if -d $file;
open (FILE,"< $file"); @filecontent = ; close FILE;
next if ! grep /^=/, @filecontent;
$file =~ s#.*\\##;
$file =~ s#\..*##;
$doccontent = `perldoc $file`;
if ($doccontent) {
print "$fileoriginal\n";
push @content, "

$fileoriginal
\n
$doccontent\n\n\n";
}
}

#print @content;

open (CONTENT, "> perldocs.txt"); print CONTENT @content; close CONTENT;

# Convert to printer-friendly version in Word with:
#Ctrl-h
#Find what:  ^p^p^p^p
#Replace with:  ^p^m
# ^m is a manual page break

> -Original Message-
> From: jeff [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, December 29, 2001 3:41 AM
> To: Beginners
> Subject: RE: Good CS Literature
>
>
> I admire your philosophy!  I purchased Learning Perl on win32 Systems by
> Schwartz, Olson
> & Christiansen read and worked the exercises and use it daily but now at a
> point where I want more.  I want to get a hard copy of the perl reference,
> but not sure what and how to print it out.  I'd like to start with the Perl
> Manpage, POD's (Supporting Manpages) and Perl Module Library.  I can only
> print individual segments from perldoc.com.  Does anyone know of an easier
> way to obtain this?  There's a lot to be said for having a hard copy.  Can't
> take my computer to bed but sure would like to fall to sleep skimming
> through perldoc.
>
> Jeff
>
> -Original Message-
> From: Michael R. Wolf [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, December 29, 2001 12:35 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Good CS Literature
>

>
> One of the things I've learned in that time is that most
> jobs have two steps.
>
> 1. get it right
> 2. get it fast
>
> Most jobs don't have the luxury of getting to step 2.
>
> Apply the rule of ducks - if it looks like a duck, quacks
> like a duck, and possibly flies like a duck -- it's probably
> a duck.
>
> Translated:
>
> If it looks like it's working software, and it acts like
> working software -- it's working software.
>
> (i.e. who cares if it's not effecient?  If you care next
> week, you can re-work it next week.)



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




Re: child processes and environment variables

2001-12-29 Thread Andrea Holstein

Thomas Maciejewski wrote:
> 
> --
> This message is intended only for the personal and confidential use of the 
>designated recipient(s) named above.  If you are not the intended recipient of this 
>message you are hereby notified that any review, dissemination, distribution or 
>copying of this message is strictly prohibited.  This communication is for 
>information purposes only and should not be regarded as an offer to sell or as a 
>solicitation of an offer to buy any financial product, an official confirmation of 
>any transaction, or as an official statement of Lehman Brothers.  Email transmission 
>cannot be guaranteed to be secure or error-free.  Therefore, we do not represent that 
>this information is complete or accurate and it should not be relied upon as such.  
>All information is subject to change without notice.

I don't want to be a policeman :-).
But the signature statement should be less than 4 lines.
So nearly 50% of your messages consists 
of the not so important signature statement.

Please don't force all other users to download unnecessary data.
Try to shorten it, and if it's impossible use a free mailer.

And again the statement does not stand for what this Perl-Newsgroup
stands for.

Greetings,
Andrea

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




Display filter for emails in mutt

2001-12-29 Thread Prahlad Vaidyanathan

Hi,

I just joined this list, and I haven't yet looked at the archives if
this has come up before ...

Now for my question - I am trying to implement a display filter for my
emails using Mutt's $display_filter variable (ie. the output of this
script is displayed in mutt's pager). Now, I want to 'smartly' wrap all
the lines longer than 70 chars, and still keep the quoting.

I tried Text::Autoformat, but it makes mutt really slow, and it seems
kind of overkill for what I want. I have attached my script below -
please suggest a way of doing this without Text::Autoformat.


#!/usr/bin/perl -w
# File: display_filter.pl
# Last Update: Sat, 29 Dec 2001 13:28:08 +0530
# Modified By: Prahlad Vaidyanathan <[EMAIL PROTECTED]>

# Usage :
#   set $display_filter in muttrc to this script, and make script executable

# THANKS
#   * thomas hurst's quotefix.rb

# TODO
#   * use g. johnson's mail-to-filter.pl to compress large to/cc headers
#   * better algorithm for blank-line consolidation
#   * line wrap at 72 chars, preserving words w/out Text::Autoformat

use strict ;
# use Text::Autoformat ; # Need it for word-wrapping 

# Change the following to suit your needs
my $quote_re = "^(-->)|^([ \t]*[A-Za-z]+>)|^([ \t]*[\|%>:!]) ?" ;
my $nonquote_re = 
"^(grub>|(https?|ftp|mailto|news|rsync|telnet|gopher):|[:;=][-+]?[\)DPdb])" ;
my $bad_sig_re = "^(-{2,3}|_{30,})\$" ; # match hotmail/yahoo ads and ML footers

my $flag = 0 ; # Flag for blank-line removal
my $line_length = 70 ;
my $line ;

# Headers (use muttrc to play with these)
while ( ( $line =  ) !~ /^$/ ) { print $line ; }
print "\n" ;

# Strip ! ;-)
while ($line = ) {
# Emacs users ... bah !
$line =~ s/> // ;
# Strip if $quote_re matches, and $nonquote_re doesn't
my $quote_depth = 0;
while ( $line =~ $quote_re && $line !~ $nonquote_re ) {
$quote_depth++; # Increment $quote_depth
$line = $' ; # $line is set to everything _after_ the matched regex
}
# Strip trailing white-spaces
$line =~ s/[\s\t]+$/\n/ ;
# Fix bad sig-dashes
$line =~ s/$bad_sig_re/-- /;
# Remove dos line-breaks
$line =~ s/
// ;
# Makes block of blank lines into one
if ( $line =~ /^$/ ) {
$flag += 1 ;
if ( $flag eq 1 ) {
print "\n" ;
next ;
}
elsif ( $flag gt 1 ) {
next ;
}
}
$flag = 0 ;
# Word wrapping
# $line = autoformat($line,{right =>70,all=>1}) ;
# Put back the 'correct' quote-string
$line = ('>' x $quote_depth) . ' ' . $line if ($quote_depth) ;
# Display it
print $line ;
}


pv.

-- 
Prahlad Vaidyanathan <[EMAIL PROTECTED]>

Those who cannot remember the past are condemned to repeat it.
-- George Santayana



msg15012/pgp0.pgp
Description: PGP signature


RE: Good CS Literature

2001-12-29 Thread jeff

I admire your philosophy!  I purchased Learning Perl on win32 Systems by
Schwartz, Olson
& Christiansen read and worked the exercises and use it daily but now at a
point where I want more.  I want to get a hard copy of the perl reference,
but not sure what and how to print it out.  I'd like to start with the Perl
Manpage, POD's (Supporting Manpages) and Perl Module Library.  I can only
print individual segments from perldoc.com.  Does anyone know of an easier
way to obtain this?  There's a lot to be said for having a hard copy.  Can't
take my computer to bed but sure would like to fall to sleep skimming
through perldoc.

Jeff

-Original Message-
From: Michael R. Wolf [mailto:[EMAIL PROTECTED]]
Sent: Saturday, December 29, 2001 12:35 AM
To: [EMAIL PROTECTED]
Subject: Re: Good CS Literature


Luke <[EMAIL PROTECTED]> writes:

> I bought the Learning Perl by Orielly but I returned it
> after realizing thats its almost the same as
> perldoc/manuals...

"Learning Perl" is a tutorial
perldoc is a reference

[...]

> My problem with programming is that i dont know if im
> doing the right thing...

It sounds like you need a tutorial to start with.  The
references are good once you've got a lay of the land, but a
reference is different from a tutorial.  The organization of
a tutorial is to start at nothing, and build understanding
in logical steps.  The organization of a reference is for
finding out the particulars of a given function or operator
if you already know that's what you want.

Perhaps you should reconsider working through the tutorial.
It's how I got started with Perl over 5 years ago.  I worked
through it *once*, then never looked at it again.  It's a
"disposable" jump start into the reference (which is dog
eared and very heavily marked and used).


> Yes the program/script works but Im not sure if its
> effecient or not...

I, too, started programming as a senior in HS.  Hard to
believe that's 20+ years ago.  Time flies like an arrow (but
fruit flies like a bannana).

One of the things I've learned in that time is that most
jobs have two steps.

1. get it right
2. get it fast

Most jobs don't have the luxury of getting to step 2.

Apply the rule of ducks - if it looks like a duck, quacks
like a duck, and possibly flies like a duck -- it's probably
a duck.

Translated:

If it looks like it's working software, and it acts like
working software -- it's working software.

(i.e. who cares if it's not effecient?  If you care next
week, you can re-work it next week.)

And, as a training exercise, you can take working software,
make some changes and see what happens.  If you break it,
restore it and try something different.  What did you learn?
If it still works, what did you learn?  The basic idea here
is to have *working* software to muck around with.  You
don't learn as well with broken software.  Get it to work
(dirty, ugly, slow, whatever), then keep it working as
your refine it into clean, pretty, fast software, and learn
lots along the way.  If you work with broken software,
you're not sure that what you did to transmute broken
software into broken software is something worth
remembering.  We call it playing with code, but it's really
a code word for learning -- take a look at my signature
file, and have fun.

Computers have been a continual mental exercise, and larning
adventure for me.

Good luck on your adventure,
Michael

--
Michael R. Wolf
All mammals learn by playing!
   [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]




dbbrowser

2001-12-29 Thread nafiseh saberi

hi dear team...
hi hamid...
do you work with dbi:dbd ???
thx.

Sincerely yours Nafiseh Saberi  

People will forget what you said ... 
People will forget what you did... 
But people will Never Forget 
how you made them feel.

< Any suggestion are welcome to me >
__



Re: I need your help

2001-12-29 Thread Roger C Haslock

'^' indicates the beginning of a line,
'$' indicates the end

will

s/^$name$/#$name/

do what you want?

- Roger -

- Original Message -
From: "Jose Vicente" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, December 29, 2001 1:26 AM
Subject: I need your help


> Hi friends.
> I am replacing a string using s///, in the following way:, but I only
> need and exact string to be replaced, for example if I have a file with
the
> following strins:
> amor
> alto
> a
> bacho
> And execute
> ~s/$name/#$name/g
>
> where $name is equal to "a", so I have
>
> #amor
> #alto
> #a
> b#acho
>
> But I want
> amor
> alto
> #a
> bacho
>
> Please help me. Because I need.
> Bye and have a good year.
>
>
>
>
>
>
> --
> 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: Question!! number of line....

2001-12-29 Thread John W. Krahn

Leon wrote:
> 
> - Original Message -
> From: "Mark Mclogan" <[EMAIL PROTECTED]>
> > How I can know in that I number of line finds a word in a text file?.
> > For example, a file "file.txt" contains the following list:
> >
> > Chocolate
> > Cake
> > Cheese
> > Apple
> > orange
> > melon
> > lemon
> >
> > How I can know in that line number is the Apple word?
> 
> open FILE, 'file.txt' or die "$!\n";
> while (){
> chomp;
> my $count++;

$count is lexically scoped to the while loop so it will always have a
value of one.

> print "Apple is found in line number $count\n" if (/Apple/);
> };
> close FILE;


John
-- 
use Perl;
program
fulfillment

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




Re: writing to a file

2001-12-29 Thread John W. Krahn

Lance Prais wrote:
> 
> Does anyone know how to grab the server time to include it in  a file?

my $date = localtime;

Or if you want UTC:

my $date = gmtime;



John
-- 
use Perl;
program
fulfillment

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