My immediate problem was checking a specific position in a string for a
specific value (if the char in the first position == '#', skip the
record). substr works OK in that case. However, I also want to learn
more and it seems regex is a better and more powerful answer.
Thank you,
Chu
duh
substr($str, 0, 1);
On Tue, 2009-09-01 at 20:49 -0400, Chuck Crisler wrote:
> How do I access specific character positions in a scalar string? In case
> it makes any difference, I specifically want to test the zeroth
> character. Something like the following.
>
> my $str = &q
How do I access specific character positions in a scalar string? In case
it makes any difference, I specifically want to test the zeroth
character. Something like the following.
my $str = "abc";
if ($str[0] == '#')
{
do something...
}
Thank you in advance!
Chuck
-
One more piece of info. I am not using a form. I have an example from
Apache for that.
Chuck
On Thu, 2009-07-16 at 20:48 -0400, Chuck Crisler wrote:
> This isn't exactly on-topic, but maybe someone can help me with this
> problem. I need to execute a Perl script on the server from
nswer, but it would really be helpful to also know where to
look for this information. :-)
Thank you,
Chuck
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
Hi,
I thought: 'perl is pretty eclectic, and it's usually simpler than it looks'.
Let's give it a try:
The following does what you want from an AIX 5.3 (perl 5.8.2) command line
perl -e'print system("ls -l")'
These are quotes and apostrophes. No "backticks."
On 3/11/09 2:36 PM, "neckha...
Hello,
I'm hoping someone can help me identify the problem I'm encountering with a
new PERL built with gcc on an AIX box. (I'd also appreciate any help in
redirecting the request, if appropriate - TIA) The symptoms are that the
debugger doesn't seem to be able to find the source code of the main
thanks for the help, everyone. We found a way that works...we used
Win32::Process::Create.
On Feb 18, 7:02 pm, chas.ow...@gmail.com (Chas. Owens) wrote:
> On Wed, Feb 18, 2009 at 12:14, Chuck wrote:
> > Hello,
>
> > We have a GUI where, if a button is clicked, Putty
Hello,
We have a GUI where, if a button is clicked, Putty (the remote access
program) is launched using
System("C:\\Progra~1\\Putty\\putty.exe");
is launched. However, when this is executed, the original GUI freezes,
and we cannot use it unless we close Putty. We tried using the fork()
command l
te package, but haven't had any luck. Any help is appreciated.
Thanks,
Chuck
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
Hi All,
I'm new to the list and know more php than perl. I can read perl and
understand some of it. One problem I seem to be facing is variable
assignment and keeping the variables from script to script. In php this
is fairly easy by assigning the global to the variable.
I'm not sure how to
. $param1."?)
panic: realloc at mybly.pl line 263.
regards,
Ajitpal Singh,
HTH,
Chuck
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
tab labeled, File Types. More than
likely, you will want to create a new association between .cgi and perl.
HTH,
Your Friendly Neighborhood DBA,
Chuck
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
es Forestieres
La Tuque, P.Q.
Tel.: (819) 676-8100 X2833
[EMAIL PROTECTED]
HTH,
Chuck
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
they like.
-- Terry Pratchett in Sourcery
Have you checked into Switch.pm ? It provides a switch/case construct
similar to a C switch.
HTH,
Chuck
!
Your Friendly Neighborhood DBA,
Chuck
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
, mac, and *nix.
HTH,
Chuck
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
I had one
semester of college 20 years ago and normally classify
myself as "finished high school". I'm curious: What level of
education have list members attained?
TEA,
Charles K. Clarkson
Took a college course in Basic back in 1980. Thats all the "higher"
educati
, one may subscribe -- of this activity may also prove useful in
the long run to the lurkers like myself.
Thanks for the cool and interesting approach to getting an answer out to
the questioner.
Chuck
[EMAIL PROTECTED] wrote:
It was Wednesday, December 03, 2003 when Casey West took the soap box
this
technique.
perl -pi -e's/Wuniq\(/hyd_uniq\(/' *.c
Regards,
Chuck
- Jason
/•
• If A equals success, then the formula is:
• X+Y+Z = A
• X is work. Y is play. And Z is keep your mouth shut.
• -Albert Einstein
•/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
Chuck Fox wrote:
Fellow perl coders,
I am having trouble wrapping my head around how to accomplish the
following:
Given a dbi result set that consists of datetime, servername,
databasename, procedurename and average elapsed time.
Convert this into an data structure suitable for export to a
work with
them. But for quick and dirty, this works fine.
Regards,
Chuck
sub DoWork
{
my( $pServer, $pUser, $pPassword, $pStartDate, $pEndDate ) = @_;
my( $Query );
my( $Count, $Error, @Rows );
my( $Line );
my( @Record );
my( $statementHandle );
my( $data );
my( $o
right place to post this.
Thanks.
The following link shows a huge list of OS level tasks and the commands
to run them on a slew of different (*nix), including our favorites
Solaris, HPUX and Linux.
http://bhami.com/rosetta.html
Enjoy
Chuck
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For
I have been listening in.
Chuck Fox
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
my biggest complaints about PHP is its inability to retreive
multiple results sets from a single call. Sybase stored procedures and
PHP don't interact very well. But in Perl, just code the loop that the
PHP command hides from you and voila, multiple result sets.
Chuck
ification, that is then exported with
appropriate extensions for your target SQL platform. ERStudio also has
a SAX basic interface that allows you to manipulate the db objects to
your hearts content.
Chuck
WindowsXP box. I had to enclose the path in double
quotes. But once I did that, Windows did the right thing,
dir "\temp"
dir "/temp"
both give me the temp directory listing. Using single quotes or
backticks does not work.
Chuck
Yet another solution
SET ROWCOUNT 1
SELECT id FROM table ORDER BY id DESC
Only works if there is an index on id and the RDBMS support backward scans
Chuck
[EMAIL PROTECTED] wrote:
Another solution :
For your query, try "SELECT MAX(id) FROM table"
That works with mysql.
-Message
In other words - save it for Perl Golf ;-)
HTH,
Thomas
PS: Perl Golf - writing code with as little (key-)strokes as possible.
Thomas,
Beyond all the enlightenment that this list brings, I am stunned
(ROTFLMAO) to realize that coding could be a sport. Cya at the 19th hole.
Chuck
--
To
ever joined. Thanks to you and all the others that post to
this forum.
Chuck
[EMAIL PROTECTED] wrote:
Ramprasad wrote:
suppose I have a hash like
%users =(
'cvs' => {
'uname' => 'cvs',
'
and would require our decryption module to make sense of it.
Again, the point is that, "secure" has to be defined for your particular
circumstances. If it makes more sense for you to use the OS to protect
passwords, then that is your "best" solution.
Good Luck,
Chuck
[EMAIL P
No matter how foolproof you make, the fools keep getting smarter.
Chuck
[EMAIL PROTECTED] wrote:
Dan Anderson wrote:
>
> He is right. Although I am new to Perl, I have had some very dumb
users
> break my PHP scripts by inputting things like "eighteen dollars and 0
> cent
we do not have web
servers calling directly to dbs, so the issue of clear text password in
the subclassed DBI module is not so much of a concern for us. Like most
places there are 9 layers of security to get through before you can try
to run perl code on a production host.
HTH,
Chuck Fox
Shirley,
I do almost the exact same thing in my database dump script. Here is
the function that I use to remove older dump files.
HTH,
Chuck Fox
### Prune Dumps Subroutine
###
### Description:
### This subroutine will
Joe,
Try XML::Writer
Chuck
[EMAIL PROTECTED] wrote:
I'm beginning my studies of XML and am looking for a Perl module(s) that
allows me to be able to dynamically generate the XML along with any data
and display it on the fly, as I now do with HTML. What I've seen so far
seems
What about using perl to massage the data into a file (or hash) and then
using gnuplot ( or Graph::Plot )
Chuck
[EMAIL PROTECTED] wrote:
--On Wednesday, August 27, 2003 1:29 PM -0500 "Akens, Anthony"
<[EMAIL PROTECTED]> wrote:
Just wanted to look into a "for fun&quo
There is always /dev/null if you really want it to go to the big bit
bucket in the sky.
Chuck
[EMAIL PROTECTED] wrote:
Sure, just use this without an open or close statement...
print VOID 'test';
I'm not exactly sure how Perl handles this, but since there is no filehandle
call
any issues with running Perl scripts, I have done this many
times. BTW, there is a nifty little program called dos2unix (not sure
if this is standard for all (*nix)), that removes extraneous carriage
returns from files.
Chuck Fox
[EMAIL PROTECTED] wrote:
I have a perl script that I developped
into memory. For some reason Perl on Linux does not want to
scan my LD_LIBRARY_PATH to find the shared libs needed by Sybase.
Any clues ? Throwing breadcrumbs is acceptable.
Chuck
[EMAIL PROTECTED] wrote:
Help!
I have written a perl module that uses XS to reach out to a password
database and
Venkat,
FWIW, I would wrap the whole job in a shell script and have cron execute
that.
Chuck
[EMAIL PROTECTED] wrote:
Anytime you have problems with a cron, the easiest place to look first is in the cronlog. If you have root access, look at the file /var/cron/log (this is Solaris, other *nix
with correctly loading the module, but I
am unsure of where to go from here. WTF does wstat = 139 mean ? Any
suggestions would be appreciated. BTW, the module cores after the tests
are finished.
Chuck Fox
Principal Database Administrator
America Online, INC.
Additional Info:
Linux AS 2.1
I have ActivePerl 5.6.0 on Win2000 (in a DOS box). I want to
find all .CSV files starting in the directory where the perl
script is. I have a program but no files are processed. Can
someone help me to get this to work? Here is the code:
at the end.
Thanks to all who assisted with the group-think.
--Chuck
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Hmmm I'm not getting where I want to go. Consider the following code:
#!/usr/bin/perl -w
@a = ( "chuck",# Good
"chuck99", # bad - numbers in a name?
"chuck_5", # bad - numbers/underscore in a name
"chuck!3&
er how it was invoked.
if ($0 eq "/path/to/prog1.pl") {
print "This is executed as program 1\n";
} else {
print "Any other name... calls this code\n";
}
# More common code
Very useful for security, argument processing, etc.
--Chuck
> --
side the set of
"[\w ]+" ???
(Yes the HTML limits both first and last name fields to 20 characters.)
--Chuck
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
System Specs
Perl 5.6.1 (dev) 5.8.0 (prod)
Mac OS X 10.2.2 (dev) NetBSD 1.5.2 (prod)
MySQL 3.23.52
I'm writing a web form to accept user applications. Like most programs,
I'd like to keep the garbage characters out to limit hacking attempts.
I want to verify the firstname and last na
print "$tstopen\n";
while () {
@fields1 = split /:/, $tstopen;
print "$fields1[0]\n";
print "$fields1[1]\n";
print "$fields1[2]\n";
print "## End of Test Open ####\n\n";
}
}
-Original Message-
From:
en (IN1, "< $file");
$tstopen = ;
chomp $tstopen;
print "$tstopen\n";
@fields1 = split /:/, $tstopen;
print "$fields1[0]\n";
chuck
-Original Message-
From: Mark Anderson [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 04, 2002 7:09 PM
To: Ch
$file found in $in_dir\n";
chomp $file;
#Open Files
open (IN1, "< $file");
$tstopen = ;
chomp $tstopen;
print "$tstopen\n";
@fields1 = split /:/, $tstopen;
print "$fields1[0]\n";
Does anyone have any idea what I am doing wrong .. OS is solaris 8.
Chuck
:52:47 GMT
Warning: Cannot install NET::FTP, don't know what it is.
Try the command
i /NET::FTP/
to find objects with matching identifiers.
Thanks in advance
chuck belcher
I have just started using perl and I have been asked to write a script
that will open a perl script, count all of the variables identified by
$... and print to the screen the number of unique variables and display
a list of variables used. Can anyone tell me where to start?
--
To unsubscribe
the event of things like "no such user". That part seems to be
working fine, but I need to increase the robustness a little more if
possible.
I would like to know if sendmail spits back an error or exit status other
than 0. Can eval() be of any help here or is there another way I can
I have Activestate Perl 5.6.0 and have been trying to use
perlcc.bat to compile a .PL file into a .EXE file. I often get
errors like "'' not found" or just the perlcc help screen. How
do I compile PL files on Win2000?
I read the docs and they were all slanted to unix. Do I need to
get a C com
I suspect there is something out there to do what I need, but I'm not
quite sure what to look for. I was hoping this would be a more efficient
way of asking...
Setup: Apache 1.3.x, Perl 5.6.0, Sun Solaris 2.7.
I need to write a CGI program that makes an HTTP connection (port 80) and
does a GET
Thanks all for the reply! This worked wonderfully. I also tried reverse()
and switching the a/b around to get a reverse sorted order with equal
success.
Thanks again!
--Chuck
> -Original Message-
> From: Nikola Janceski [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February
Does anyone have any clever ideas for sorting an array of hashes based on
a key such as an ID number?
Example:
@AoH = (
{ ID => 10101, UserID => 1041, Status => 2 },
{ ID => 10541, UserID => 1211, Status => 1 },
{ ID => 10111, UserID => 1211, Status => 2 },
{ ID =
I'll have to keep this in mind. I don't think it applies here since my
return value is either a 0 or a 1 (no records read or valid data found). I
fill in the hash reference from the database data.
It never hurts to learn about a new module!
--Chuck
> -Original Message-
> >sub GetUser
> >{
> > my ($id, $user)=@_; # record number and hash reference to
> >populate
> >
> > if (defined($UserCache[$id])) {
> >$user = $UserCache[$id];
>
> >return(1);
>
return 1;
}
Thanks
--Chuck
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
= (0, 3, 6, 9, 154);
my $LastElement=&MySub(\@MyArray);
print "The last element is: $LastElement\n";
What goes in ___?
--Chuck
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
p only reports
first and third?
foreach $k (keys %list) {
print "$k=$list{$k}\n";
}
Thanks
--Chuck
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Here's one I can answer! I agonized over this for weeks, but finally got a
decent solution that I use every day!
For a binary file I would recommend "use MIME:Base64". An example is
provided.
Notes:
o You'll want to use multi-part MIME encoding (hence the use of
MIME::Base64). You cou
I define global variables in a package (e.g. $MyVars::SystemName =
"chuck";). It may only be used in THIS program once, but several other
programs need that value. True, modifying it wouldn't be the end of the
world, but that could lead to unforeseen problems later if you do some
I hate those. I usually end up creating a log file (or stderr in the case
of web apps) and just print them out to use them again. Nice debugging, but
needless in some cases.
If you figure a good way use the variable more than once without affecting
the value, I'd like to hear it.
--
It turns out that
(caller 0)[3]
got me pretty close to what I was looking for.
Thanks.
> -Original Message-
> From: Bob Showalter [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, November 21, 2001 11:06 AM
> To: 'Tomasi, Chuck'; '[EMAIL PROTECTED]'
&g
I find myself writing this sort of thing a lot:
print STDERR "program.pl: subname(): debug statement\n";
I know $0 can be used for programname.pl (except it returns the full path to
the program), is there some cool variable to get my hands on the name of the
current sub?
--Chu
using strict, I get the dubious message:
Use of uninitialized value in concatenation (.) at /path...pl line 1288
every time a record comes up with no title field populated.
Is there some way to make this work whether a value was read from the
database or not?
print "\t\t$ulist[$i]{'Title
(@$aref) loop walks right over the hash ref and I get information at
the end of @leftovers "main::hash".
--Chuck
> -Original Message-
> From: Dave Storrs [mailto:[EMAIL PROTECTED]]
> Sent: Friday, November 16, 2001 11:38 AM
> To: '[EMAIL PROTECTED]'
> S
r foreach() loop to dump the values after calling &ref(), there they
were. Now to see if my larger program adheres to the same logic.
You're confused?! I thought I was a decent Perl programmer until I forced
myself to use strict and -w!
Thanks!
--Chuck
> -Original Message-
be
> somewhere else. Step through your code in the debugger.
Never used it before. I'll see what I can come up with from the
help/manpage. Thanks.
--Chuck
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
ds.
I saw this done a while ago with a hash, but it was using a convention
something like:
&mysub(*hashname);
What's that all about? How are items in %hashname referenced (or
dereferenced as the case may be) in mysub()?
--Chuck
> -Original Message-
> From: Wagner-Davi
Perl: 5.6.0
OS: Solaris 7
Goal: Scan a text file for key words/values and populate a hash
My parsing works, but the main() never sees the values properly. If I'm
passing by reference, why isn't the hash I passed getting populated in the
main namespace?
Thanks
--Chuck
--
Dang, I could swear I tried that and it wasn't behaving like it was a ref.
Now that I've tried it, I'll have to use it that way. Thanks a lot!
> -Original Message-
> From: Bob Showalter [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, November 15, 2001 2:00 PM
> T
MailAddr});
where mysub is expecting two hashes, but really only uses the Address field
from the second. If it must be references, it must be references...
--Chuck
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, November 15, 2001 12:14
Perl 5.6.0
Sun Solaris 2.7
I'd like to send two or more associative arrays (hashes) to a sub. It looks
like the first one makes it but the values of the second never get passed.
Am I doing something wrong or is there a better way to do this (I'm hoping
you don't say by reference or I'll have to
> die "Only root can run this script" if getpwuid($<) ne 'root';
getpwuid($<) returns the entire passwd entry and would require a little
parsing. How about something more like:
die "Only root can run this script" if ($< != 0);
--Chuck
--
To
er's examples in the past, but now I understand them
well enough to construct and use them myself. My Perl knowledge just went
up another knotch!
Thank you again!
--Chuck
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
ght, but how can you print a variable that hasn't
> been defined yet?
>
> dan
>
> * Tomasi, Chuck ([EMAIL PROTECTED]) wrote:
> > System: Sun Ultra 2, Solaris 7 (11/99)
> > Perl: 5.6.0
> >
> > I have a series of related
An if/else with the same code is pointless. Why not use use the same
statement all the time? The %02d won't do anything if both digit places are
filled. Printing "5" with %02d comes out 05, printing 25 with %02d comes
out 25. What's the point?
> -Original Message-
> From: [EMAIL PROTE
t "Welcome to $DOMAIN, $ADMIN\n";
#!/usr/local/bin/perl -w
use strict;
my $DOMAIN="plexus.com";
my $ADMIN="Chuck";
Of course, when I run g.pl I g
as getprint and getstore work. When I
replaced the above line with one of the following,
output was returned.
getprint ("http://www.google.com";);
or
$file=test;
getstore ("http://www.google.com";, $file);
Anyone know why
On Wednesday, August 1, 2001, at 04:29 PM, beginners-digest-
[EMAIL PROTECTED] wrote:
> Whilst this could be done in Perl, I don't think it has been, and I
> don't think it's a task for a beginner.
>
> I would take a look at comp.software.testing
>
> Point a browser at http://www.testingfaqs.org/
I'm trying to take a string, which may or may not contain a $ and/or
a comma, and return just the number with 2 decimal places. I am
having some trouble. Here is my test code:
$a[0]="$1,234.05";
$a[1]="1234.78";
$a[2]="$768";
$a[3]="777.99";
for ($j=0; $j<=3; $j++)
{
print "$j. " . Stripprice(
ially it's telling me that the script is not sending any output to the
webserver...
Any clues for me?
Chuck
__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/
--
To unsubscribe, e-ma
Hi All,
I'm a raw newbie to Perl, but have been coding in Turbo Pascal for many years.
As a way to learn Perl, I've decided to re-implement a text adventure framework that I
wrote in TP
many years ago, that served as a Pascal training vehicle for me.
In Pascal, I used to create an array or link
On Wednesday, June 27, 2001, at 08:59 AM, [EMAIL PROTECTED]
wrote:
Hi,
I am writing a script to be used on Windows and many different
flavors
of Unix. I am looking for a good way to convert Unix paths to Windows.
Any
Ideas?
Not exactly an answer to your question, but perhaps someth
On Wednesday, June 13, 2001, at 12:05 PM, Ward, Stefan wrote:
> Does anyone have an example of a way to write a perl script that will
> go out
> hit a data base table, pull in a column for that table and use that
> column
> in a dropdown list? I know what to do once I get that variable
> sel
On Tuesday, June 5, 2001, at 07:37 AM, Randal L. Schwartz wrote:
> That's why I bring it up as a meta-topic. We've had
> to deal with the same thing on perlmonks.org
Randal, no offence meant, but I was under the impression that the
purpose of this list was to answer questions, and not say tell
First post, quick question:
I've got an array of hashes that I'm defining the most basic way I can...
my $gSeasonID;
my @season_list = '';
while (@fields = $sth->fetchrow_array) {
$gSeasonID = $fields[0];
$season_list[$gSeasonID]{number} = $fields[1];
$season_list[$gSeaso
90 matches
Mail list logo