However, since the whole idea behind using local or my with variables
is to prevent a variable name from writing over the same variable
name elsewhere in the script, it makes even *more* sense to me to
use local with Perl's special variables; in that they are used frequently
throughout one's scri
for example in a connection:
my $dbh - DBI->connect("DBI:ODBC:$ini{dsn}", $ini{userid}, $ini{pw}) ||
die
Is that what you are looking for?
Steve H.
-Original Message-
From: Keith A. Calaman [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 04, 2002 5:25 PM
To: Steve Howard
$sheet->Range("A1:B11")->Select();
$sheet->Range("A1:B11")->Copy();
#paste into the word doc:
$doc->Words->Last->Select();
$wd->Selection->Paste();
$doc->Words->Last->Select();
$wd->Selection->InsertAfter("End of our document\n")
You need to install Perl (if you haven't). If you're on Windows, and have
never programmed before, hopefully, you have downloaded Activestate's
binaries, - they have an MSI to install everything.
If you install using Activestate's MSI file, .pl will already be associated
with the perl.exe program
In the above example i had to escape the quotes to use them.
There's nothing wrong with escaping quotes, but Perl has enough quote
notations that it is almost never a "have to" to escape them. You could
define your variables like this:
my $bilbo = qq{Bilbo,"Why I like rings" Freemont Press, 19
commenting on your code :)
Steve H.
-Original Message-
From: Steve Howard [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 02, 2002 11:00 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: pop-up box JOIN() to mysql not populating dates
Keith, I can't tell much from wha
Keith, I can't tell much from what I'm seeing that should cause a problem. I
might suggest a couple of steps for tracking it down, then I'll offer you a
bit of advice on safely inserting data that in taken from user input.
First, you have said that the print from the year prints the date in the
f
I don't think you are understanding the increment notation. To increment
$saveNum($dup}, all you want on the line is this:
$saveNum{$dup}++;
not:
$saveNum{$dup} = $saveNum{$dup}++;
Steve H.
-Original Message-
From: david wright [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 02,
If you only have one equals sign dividing what you don't need, and what you
are looking for:
$string = "interfaces.ifTable.ifEntry.ifInOctets.4 = 954819405";
($key, $val) = split /=/, $string;
Steve H.
-Original Message-
From: Ask Bjoern Hansen [mailto:[EMAIL PROTECTED]]
Sent: Tuesday,
Good info, and I would only add one more mailing list to what is given:
DBI users group. Find them on CPAN or ACTIVESTATE.COM to subscribe, Just
monitor them for a while, there are some very slick examples you can pick up
on.
Steve H.
-Original Message-
From: jim-ryan [mailto:[EMAIL PRO
Once again we see this truth:
Those who can, do. Those who can't, teach...and come up with their own
definitions of things like this showing how little experience they really
have with real world situations. I'm sure their explanation makes themselves
feel superior, and at the same time shows the
Yes, and it is quite easy. You do need an access file to exist first, but
once that exists, you can add tables and indexes, insert, update, delete
select and anything else you might think of to do with it.
You need the DBI module, and the DBD::ODBC module. Perldoc DBI will tell you
how the DBI an
To: '[EMAIL PROTECTED]'
Subject: RE: Regular expresions
i think the /D switch is best...
$str = 'YD*&h9dhiudhc9s9123abc&&%$&()_#';
print $str, "\n";
$str =~ s/\D//g;
print $str, "\n";
> -Origin
With only one line from a logfile to work with, I have to do a little
guessing about format, but if all lines are formatted like that one, and if
days always have a two digit format, and if a lot of other assumptions, This
snippet does what you are looking to do:
my ($mon, $mday) = (localtime(ti
It might be helpful if you posted at least the part of the code that is
having trouble. it's difficult to say what went wrong when we can't really
see what is even happening.
Steve H.
-Original Message-
From: Vincent Lim [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 15, 2001 9:35 AM
You need to quote "blah".
$test = "blah";
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 14, 2001 6:04 PM
To: [EMAIL PROTECTED]
Subject: printing to a filehandle
I need some help figuring out where I'm going wrong with trying to print to
thi
The docs for DBD::ODBC give examples of how to make connections. perdoc DBI
gives a lot of good examples of how to use DBI, and diagrams out the place
of DBI and DBD in the application. That's probably enough to get you started
with it.
As for whether it can be used with Win 2K and Access, yes.
I've seen an example of MySQL's limit, and I gave an example of MS's TOP
earlier. There is a more universal way, but this is very inefficient
compared to a LIMIT or TOP or some other method if you have them available.
However, just to give you another possibility:
Almost every DBMS has some sort
The answer to this is probably in your DBMS. What DBMS are you using.
Different ones have different ways to page the data. Using MySQL you need to
use the LIMIT keyword to specify how many rows to skip, and how many to
return (when two parameters are used with limit).
Using MSSQL 7.0 or later you
eve H.
-Original Message-
From: Michael Fowler [mailto:[EMAIL PROTECTED]]
Sent: Sunday, August 05, 2001 10:02 PM
To: Steve Howard
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: If Statement won't work
On Sun, Aug 05, 2001 at 09:51:15AM -0500, Steve Howard wrote:
> By any chance
Actualy, what you did is not a hash, but three scalars - and yes, that would work. To
use a hash SLICE local to the subroutine, you would do it like this:
sub sonic
{
my %lh;
@lh{qw(numhits maxhits hits)} = @_;
...
}
After that, you could refer to the values locally as:
$lh{numhits
By any chance are you using Activestate? I have no explanation, but I have
run across two or three times when everything should have worked, the
variable evalueated to what it should have been, but the if refused to
return true and execute. those three times I have been able to delete the
line and
This is really ugly, but if you have the memory to handle a file that might
only use \r, and you don't mind using a temp file for the processing, here
is one possibility.
open(file, "c:/blah/sample.txt") || die "$!\n";
open(tempfile, ">c:/blah/temp.txt") || die "$!\n";
foreach () {
AT is part of the standard installation on NT4. There is no need to install
it separately. If the schedule service is running on the remote machine, and
your account has rights on it, just designate the remote machine between the
AT and the time like this from command prompt:
at \\remotemachine
Almost right. Windows 2000 has a scheduler in the control panel, and you can
set a single schedule to run every 5 minutes from a start time to a stop
time every day by using a weekly schedule. This has a front end GUI, but
still works with the legacy AT like in NT4. However using the AT may not be
Someone may be equipped to answer this on this list, but if not, I'm sure
you could get it answered on the DBI users group. I haven't seen this post
on that list, have you tried them?
Steve H.
-Original Message-
From: Webster, Murray [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 24, 200
Date::Calc has functions to make that very easy.
Steve H.
-Original Message-
From: shweta shah [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 24, 2001 6:24 AM
To: [EMAIL PROTECTED]
Subject: how to get date before say 20 days ?
hello,
is there something in perl through which i can get
- it is a very good doc, and you will see what kind of tools it
really offers.
Hope this helps,
Steve H.
-Original Message-
From: Groove Salad [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 23, 2001 2:06 PM
To: Steve Howard
Cc: [EMAIL PROTECTED]
Subject: newbie: Date::Calc Question
Hi,
]
Sent: Monday, July 23, 2001 2:06 PM
To: Steve Howard
Cc: [EMAIL PROTECTED]
Subject: newbie: Date::Calc Question
Hi,
I've been reading the latest post regarding the Date::Calc module with
great interest.
My question is this:
Is there a way using Date::Calc to determine all the files in a D
further manipulations of system dates to get there.
Steve H.
-Original Message-
From: Jeff 'japhy/Marillion' Pinyan [mailto:[EMAIL PROTECTED]]
Sent: Sunday, July 22, 2001 9:37 AM
To: Steve Howard
Cc: Ackim Chisha; [EMAIL PROTECTED]
Subject: RE: Dates subtraction
On Jul 22, Stev
e to use a hash like I did with the localtime function, I just
like working with the hash slices. Customize that to your purpose.
Hope this helps,
Steve Howard
-Original Message-
From: Ackim Chisha [mailto:[EMAIL PROTECTED]]
Sent: Sunday, July 22, 2001 8:50 AM
To: [EMAIL PROTECTED]
Subject: D
Sounds as if you need to use the DATE::CALC module. All the date addition,
subtraction, formatting, generation etc. functions I have ever had need for
are in there, and it has very good documentation in its perldoc. It's
probably not part of your standard installation, though. I'd try it and see
i
Just a note on this. This does not work with all dbd's the version of
DBD::ODBC I work with is one where it will not work. No matter how many rows
are actually returned, $rows will always be -1 on this dbd. This is hinted
at in perldoc DBI by the use of "if available" in the descriptions of this
t
hat I
know about it, and I won't comment further.
Back to programming.
Steve H.
-Original Message-
From: Mark Winchester [mailto:[EMAIL PROTECTED]]
Sent: Saturday, July 14, 2001 10:38 PM
To: [EMAIL PROTECTED]
Subject: RE: 15 O'Reilly computer books free for download
---
Illegal may be a moot point. The site is in Russia, and it is not likely any
enforcement will ever do anything about it. Definitely not ethical, though.
-Original Message-
From: Pete Sergeant [mailto:[EMAIL PROTECTED]]
Sent: Saturday, July 14, 2001 4:38 PM
To: [EMAIL PROTECTED]
Subject: R
The first place in your array is 0, There are a couple of examples of
foreach that I don't mind giving:
my @array = qw{this is the example of the array we will use for this
example};
foreach(@array) {
print $_."\n"; # current element is $_
}
or if you need the index of
I'm not quite sure you're understanding what form the output will be in when
it gets into your script, but one question at a time:
The first question will vary slightly from dbd to dbd. However, in all cases
you will need to install DBI. After DBI, install the DBD for the the type of
connection y
Ok, it's getting late. you have to use double quotes.
$target = $var1."\<".$var2."\>";
Sorry,
Steve H.
-Original Message-
From: Notabene [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 05, 2001 11:36 PM
To: Perl Beginners
Subject: Assigning '<' & '>' as chars to a variable
Okay, I su
Escape the characters.
$target = $var1.'\<'.$var2.'\>';
See if those back slashes get you what you want to see.
Steve H.
-Original Message-
From: Notabene [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 05, 2001 11:36 PM
To: Perl Beginners
Subject: Assigning '<' & '>' as chars to a vari
ition. I can't teach you all there is to know about SQL 7's
system catalogues, but you have everything you need in sysobjects, and
syscolumns, and sysindexes (although I usually use sp_helpindex to bring in
information to create indexes on the fly). From there, it's really up to you
ho
Two ways you can do it that I can give an example of. One is to query the
system catalogue directly embedding this:
SELECT name FROM syscolumns WHERE id = object_id('')
(of course, substituting the table name in the appropriate place).
or, if you are using DBI, you can pull a full list of colu
You need DBI
and
DBD::MySQL
They should be avaliable on CPAN, or if you are using ActivePerl or PPM they
can be installed with just:
ppm install DBI
ppm install DBD::MYSQL
That should be all you need to interact with MySQL.
Steve Howard
-Original Message-
From: Ryan Gralinski [mailto
And (Since there are so many ways to do things in Perl) if you absolutely
needed the index of the array as you were printing (like if something else
was being done inside the loop besides a simple loop) you can still do it
simpler than the C like loop you are using by doing a:
foreach (0..scalar(
further examples.
If, however, you must drop a command through to the shell to pull a date
from NT, the commands for date, and time are:
date /t
time /t
Enjoy,
Steve Howard
-Original Message-
From: Tom Yarrish [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 26, 2001 10:31 PM
To: [EMAIL
ew little ideas,
but the actual answer will vary between DBMS's.
Enjoy,
Steve Howard
-Original Message-
From: Abdulaziz Ghuloum [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 26, 2001 1:19 PM
To: Rajeev Rumale; [EMAIL PROTECTED]
Subject: Re: Paging the Data..
You can limit the numb
Any version is large,
and slow.
Steve Howard
-Original Message-
From: Aaron Craig [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 22, 2001 5:47 AM
To: [EMAIL PROTECTED]
Subject: Komodo
Has anyone tried the Komodo development environment from ActiveState? Must
you have ActiveState perl i
is
just one of the easier ways to do it.
Hope this helps
Steve Howard
-Original Message-
From: Kolene Isbell [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 20, 2001 4:36 PM
To: [EMAIL PROTECTED]
Subject: Perl DBI question
I'm trying to print out statistics on a web page, bas
http://www.peacecomputers.com/addressbook_toot-intro.html
I know it involves reading, but it is step by step, commented, and
documented, and you can follow it along to build a sound CGI app. Once you
have that down you can build your own.
Hope this helps again,
Steve Howard
-Original Message-
From: [
es your life much, much
easier.
Ok, end of my DBA diatribe.
I might recommend also that you check out the DBI users group. I'm on that
one, and there are very, very slick examples of DBI programming given by
some very sharp people on that group. Just following the examples will help
you a lot.
Hope th
pathext=%pathext%;.pl
You can set that permanently in the System applet in your control panel.
once .pl appears in your pathext, you can actually start myprog.pl by
typing:
myprog
and hitting return. NT will recognize it.
Steve Howard
-Original Message-
From: Chris Garringer [mailto:[EMAIL P
nt me to a good walk-through example, or give me a good
walk-through example of using B. And if I am not understanding right that B
is a module to work with the C compiler to compile perl code into native
executable programs please set me straight on that as well.
Thanks in advance.
Steve Howard
in
less than three seconds and wrote the new contents to the new file. Granted,
I am using a different OS than when I did that test before, but still, the
difference was virtually indiscernible. Therefore, I'll concede my point
about a significant performance difference.
Steve H
Can you give us an example of the code that is not connecting, or not
working? It's pretty difficult to answer with no more than we have to go on.
Steve Howard
-Original Message-
From: justin todd [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 13, 2001 7:22 AM
To: Beginners (E
pe of the question asked
when responding here.
Steve Howard
-Original Message-
From: Jos Boumans [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 13, 2001 6:55 AM
To: Steve Howard
Cc: Stephen Henderson; [EMAIL PROTECTED]
Subject: Re: use of split command
I'd like to make a few adju
ituation, as in most, it depends on what you need. Your point is
well taken, but sometimes the best way is to load the entire file into an
array.
Steve Howard
-Original Message-
From: Evgeny Goldin (aka Genie) [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 12, 2001 7:03 PM
To: [EMAIL PROTECT
ier)
using the AT command similar to what I did above.
None of those are pretty examples, but they are things I do because I have
yet to find a pretty way to start execution on a remote box. However, let me
know if you find somethingit'll make my life a lot easier as well.
Steve Howard
--
ables
}
you are right, that is a very fast way to deal with files.
If you have regularly delimited files, and would prefer to work with them
using SQL like syntax, you might look at DBD::CSV for another alternative.
Steve Howard
-Original Message-
From: Stephen Henderson [mailto:[E
When you "rRequire" or "use" I believe it will only recognize a .pm
extension. I'm pretty sure I've run into this before. (Someone correct me if
I'm wrong.) When you say:
require conf.cgi;
it is looking for:
conf.cgi.pm
and not finding that.
Hope this he
.
You can use whatever makes sense in your program.
Hope this helps.
Steve Howard
-Original Message-
From: Brent Michalski [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 11, 2001 9:02 AM
To: FLAHERTY, JIM-CONT
Cc: Beginners (E-mail)
Subject: Re: Issuing rollback() for database handle be
Quick comment: Make sure the quote types match when opening the file:
open (FILE, ">text.txt");
-Original Message-
From: - [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 11, 2001 10:15 PM
To: [EMAIL PROTECTED]
Subject: Re: how to create a file
On Monday 11 June 2001 19:52, bdale16 wro
60 matches
Mail list logo