why are you sending me copies of all email in and out of [EMAIL PROTECTED]?
here you can have them back
 


Just testing, please ignore this message.

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GIT/U d-->(---) s: a->? C++(---) U*++>L+++ P+>+++++ L+(++)>++++ E- W+++$
N++@ K w(---) !O? M-- V? PS+ PE Y+ PGP t+ 5-- X+ R@ tv-->--- b+>+++ D+++ G
e>++ h- r*- y-++
------END GEEK CODE BLOCK------




Thanxs!

I was thinking I had to use a float....

> -----Original Message-----
> From: Brett W. McCoy [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 09, 2001 11:35
> To: Yacketta, Ronald
> Cc: Beginners (E-mail)
> Subject: Re: help with printf formatting please
> 
> 
> On Thu, 9 Aug 2001, Yacketta, Ronald wrote:
> 
> > I do not get the 0 as in 09 , 08, 07 ,06 etc..
> >
> > what could I do to ensure that the $sec is _always_ 2 digits?
> 
> Precede your format specifier with 0#:
> 
> ~$ perl -e 'printf("%02d\n", 6);'
> 06
> ~$ perl -e 'printf("%03d\n", 6);'
> 006
> 
> -- Brett
> 
>                                  http://www.chapelperilous.net/btfwk/
> --------------------------------------------------------------
> ----------
> Time flies like an arrow.  Fruit flies like a banana.
> 

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




Folks,

I have this little tad bit of code

        my $left = $timer - time();
        my $min = $left / 60 % 60;
        my $sec = $left % 60;
        sleep $ARGV[1];
        printf OFN "Time remaining until next egrep: %d:%d\n", $min, $sec;

works like a champ! except the output formatting
The $min is no problem, but I have a prob with $sec, when it goes below 10
seconds
I do not get the 0 as in 09 , 08, 07 ,06 etc..

what could I do to ensure that the $sec is _always_ 2 digits?

%.0f ???

-Ron

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




Folks,

I have been reading up on the Benchmark.pm, I thought it was possible to
time
a sub routine with timeit as such

$gt = timeit( 1 , &some_sub );

but I am getting errors in the Benchmark.pm

Use of uninitialized value at /usr/local/lib/perl5/5.00503/Benchmark.pm line
312.
bad time value () at /usr/local/lib/perl5/5.00503/Benchmark.pm line 313.
Can't call method "cpu_p" on an undefined value at
/usr/local/lib/perl5/5.00503/Benchmark.pm line 315.

Regards,
Ron

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




        But don't you need to distinguish between: n-4.t-1 and n-4.t-11? And
if you are passed only t-1 then that should be distinguised from t-11 or
t-100?

        I looked at :

        $mylead = '';
 while(<FILE>) {
    chomp;
    $mylead = '^';
    if ( $named_passed =~ /^t/ ) {
       $mylead = '';
     }
    if (/${mylead}$name_passed$/) {
        .....

    By doing the above, you match against whole name if n-4.t-1 is passed or
only the node if t-1 is passed.  I could be missing something.

Wags ;)
-----Original Message-----
From: Lynn Glessner [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 09, 2001 10:18
To: Sofia; [EMAIL PROTECTED]
Subject: Re: Matching strings


I think that you just need to match the other way around to get the partial
match.
Instead of looking for the fileline within the name_passed, look for the
name_passed within the fileline.

Something like this should do the desired partial match, and be shorter and
clearer (at least to me, another newbie).

 while(<FILE>) {
    chomp;
    if (/$name_passed/) {
        .....

----- Original Message -----
From: "Sofia" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 09, 2001 9:59 AM
Subject: Matching strings


> I am having problems matching strings.  I have the
> following code that reads a file with computer names
> and if a named passed to the script is in the file
> print yes otherwise print no, for example. The
> computer names are in the format n-4.t-1 meaning node
> four on rack 1.
>
> while(<FILE>) {
>    $line = $_;
>    chomp($line);
>    $_ = $name_passed; # name is the argument passed to
> this script
>    if (/$line/) {
>        print "yes\n";
>        exit 0;
>    }
> }
> print "no\n";
>
> Now, if the file contains computer n-4.t-1 and I want
> to see if computer n-4.t-11 exists in the file (which
> it doesn't) the script return yes because it matches
> n-4.t-1.  However, the file might contain the entry
> "t-2" which means that all the nodes on rack 2 need to
> be disabled.  So, if I passed the script the name of
> n-4.t-2, the script should return "yes" because that
> nodes is part of rack 2.
>
> Any ideas anyone???
>
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/
>
> --
> 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]




How do I print an e-mail address to a file.  For example,
[EMAIL PROTECTED]


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














On Thursday 09 August 2001 10:32, [EMAIL PROTECTED] wrote:
> "Syntax error at perl.txt line 8, near "$x".
>  Execution of perl.txt aborted due to compilation errors."
>
> $x=getc(INFILE);
> while($x!=eof(INFILE){

You'e missing a closing paren here.

However, even when I fix that this doesn't seem to run.  I have to admit,
I've never, ever used the getc() function.  This is definitely not the
canonical way to read from a file.

I guess I'd do something like this:

while( <INFILE> ){
    # process line here
}

But this gets the file a line at a time.

Do you really want to process the file a byte at a time?  I'd be inclined to
read the whole file into a variable and process each character another way.
Of course, there are certainly reasons you might want to process the file a
byte at a time and getc() might be exactly what you need - I'm just not that
familiar with it.

See also seek() if you need byte at a time access.

Regards,

Troy



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




Here are three other possibilities:

1) You might be able to avoid VB entirely by using the
Spreadsheet::ParseExcel module, although I haven't tried it and can't vouch
for it.

2) If Excel is installed on the machine that's running the Perl Script, you
should be able to call the Excel object directly via Win32::OLE.

3) You could wrap the VB functionality up into a COM object and then use
Win32::OLE to call it, so that you're calling VB from Perl, instead of the
other way around.

-----Original Message-----
From: Busse, Rich [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 09, 2001 2:07 PM
To: Michael Carmody
Cc: [EMAIL PROTECTED]
Subject: RE: A little off topic - VB & Perl


You can use the Shell function, according to my ancient VB 3.0 manual:

Dim TaskId, Style

        TaskId = Shell ("perlscript.bat", Style)

Simple? However:
* You should also code an On Error in case VB can't run/find perlscript.bat.
* 'Style' is a number 1-9 depending on how you want to run it. 1=normal with
focus, 2=minimized with focus, 3=maximized with focus, 4=normal w/o focus,
6=minimized w/o focus. Check the Microsoft web site under VB / MSDN for more
info.
* The process runs asynchronously - and I don't think VB has a 'wait'
command.

Of course, all this could have changed in the past 8 years...


-----Original Message-----
From: Michael Carmody [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 08 August, 2001 22:22
To: [EMAIL PROTECTED]
Subject: A little off topic.


Having crafted my masterpiece in perl, I now need to get it to run from
within a VB script.

(VB takes office file, converts to .csv, which perl scripts then parses,
but poor secretary has to have excel doco to work on....)
So this is only in the interest of allowing perl to actually be used at my
work in a real environment (as opposed to only me using when I need it)
and being seen as a REAL tool, even though it's free/open source/not
microsoft

So how do i get visual basic to call external executable files ?
Such as perlscript.bat containing "perl myscript.pl"

Any help doubly appreciated...

Michael Carmody
MDU, Public Health Lab
Dept. of Microbiology and Immunology
The University of Melbourne, Parkville




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



















The 3rd edition of Learning Perl just came out.  I like it it takes a more
platform independent approach, whereas before there were 2 learning perls
now there is only one.

> -----Original Message-----
> From: murphy, daniel (BMC Eng) [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, August 09, 2001 3:11 PM
> To:   [EMAIL PROTECTED]
> Subject:      RE: platform win ME
>
> Better yet, get "Learning Perl on Win32 Systems" (O'Reilly)
>
> Dan Murphy                           [EMAIL PROTECTED]
> EMC Corp.                            508-435-1000 x14559
> Hopkinton, MA  01748
>
>       EMC2
>       where information lives
>
>
>
>
> -----Original Message-----
> From: Peter Scott [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 09, 2001 12:38 PM
> To: Kent Mercer
> Cc: [EMAIL PROTECTED]
> Subject: Re: platform win ME
>
>
> At 10:12 AM 8/9/01 -0600, Kent Mercer wrote:
>
> >----- Original Message -----
> >From: "Peter Scott" <[EMAIL PROTECTED]>
> > > >How do I begin my first script?
> > > >
> > > >And how do I save it ?
> > > >
> > > >Something simple like "Hello World"
> > > >
> > > >Just started 2 days ago
> > > >Need pointed in the right direction
> > >
> > > What platform are you on?  Windows, Mac, Unix, VMS, Palm...?
>
> Ah, okay, Windows ME.  A la Mrs. Beeton, first, get your perl.  Go to
> http://aspn.activestate.com/ASPN/Downloads/ActivePerl/ and download the
> Windows MSI version (I'm guessing here that Windows ME has support for the
>
> MS Installer; if not, get the Windows AS package.)  Install it and accept
> all the defaults.
>
> Then, use Notepad to create a file called hw.pl containing the text
> between
> the lines below:
>
> -------------------------------
> #!/usr/bin/perl -w
> use strict;
> print "Hello World\n";
> -------------------------------
>
> [Some people will argue about putting the use strict line in your first
> program, but I say, you're going to put it in any program that does
> anything useful, so why not get in the habit from the beginning.]
>
> Then open a command prompt window to the same directory, and type
>
>          perl hw.pl
>
> and tell us if that doesn't work.
>
> --
> Peter Scott
> Pacific Systems Design Technologies
> http://www.perldebugged.com
>
>
> --
> 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]




"Kevin Hundley" <[EMAIL PROTECTED]> writes:
> The code does exactly what I want.  However, I get the following message
> (when the perl -w option is enabled):
> Use of uninitialized value at (eval 11) line 17.
> ....
> Is this message something I should just live with (or turn off the -w
> option)?  Or is this a minor bug in the CGI module?  Or, being a newbie to
> Perl, am I doing something else wrong?

Older versions of CGI.pm had a minor bug where included scripts
triggered this warning.  It's been fixed in the newer versions,
so try upgrading your copy of CGI.pm to the most recent version.
I suspect the problem will then just disappear.

+ Richard

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

Reply via email to