',
| -textvariable=>\$y,
| -width=>$lw,
| -anchor=>'w',
| -bg=>'white')->pack(-anchor=>'w');
|
| }
The parameters are passed in the special
ooking at permissions and paths. Often in
CGI scripts the path to the file is not what is expected.
-spp
--
Stephen P PotterColumbus, Ohio, USA [EMAIL PROTECTED]
"You can't just magically invoke Larry and expect that to prove your point.
Or prove that you have a poi
as running it through your web server, you'll need to provide more
information. Check your log files to see what error it is reporting. Are
you sure that /ecommerce/webpages/cgi-bin is actually set up to be the
proper location for CGI execution?
-spp
--
Stephen P PotterColumbus, Ohio,
ooking for. This holds for any list context where an array
| is used, not just for/foreach (e.g. print(), join(), map(), etc.)
No, you want to supply a list to foreach, not an array. If you rewrite the
above using a list for most everywhere you say array, you see how much
simpler it
ething
like:
perl -M[name] -e 'print $[name]::VERSION'
for example:
$ perl -MCPAN -e 'print $CPAN::VERSION'
1.52
$
or, even more simply
perl -M[name] -e ''
for example:
$ perl -MCPAN -e ''
$
$ perl -Mfake -e ''
Can't locate fake.pm in @
g is not true. There is no way to have foreach
tell you what element you are on, although it is possible to find it out
indirectly. It will, however, always walk the array by going from memory
location to memory location, so it will always traverse it in the same
order.
-spp
--
Stephen P Potter
ays be ordered by subscript. With % it will always be
in the hash order, you just may not be able to guess what the hash order
is.
-spp
--
Stephen P PotterColumbus, Ohio, USA [EMAIL PROTECTED]
"You can't just magically invoke Larry and expect that to prove your point.
O
e is output, you'll
probably see it on STDOUT (your screen). The backticks do much the same as
system() except that the output of the command is what is returned.
So, try:
$command = 'pgp -kv';
$output = `$command`;
print "The output is: \n";
print $output;
-spp
--
Stephen P
make test
make install
Sometimes there might be pre-requisite modules that you'll also have to get
and install. Repeat this procedure until you get everything.
-spp
--
Stephen P Potter [EMAIL PROTECTED]
"You can't just magically invoke
Lightning flashed, thunder crashed and Jeff 'japhy/Marillion' Pinyan whispered:
| On Aug 28, Stephen P. Potter said:
|
| >Lightning flashed, thunder crashed and Maxim Berlin <[EMAIL PROTECTED]> whispere
> d:
| >|
| >| well, ${ unassigned now...
| >|
|
Lightning flashed, thunder crashed and Maxim Berlin <[EMAIL PROTECTED]> whispered:
|
| well, ${ unassigned now...
|
And must remain unassigned, otherwise there is no way to disambiguate:
print "$dayday"
and
print "${day}day"
-spp
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional c
did you come up with the offsets? Are you guaranteed that
$index and $value will only have digits in them? If so, $index+0 will
conver the string "000234" into the digit 234. Or, if you want, you can
use /^0+/ to remove the leading zeros.
-spp
--
Stephen P Potter
n't have to modify the array inside
the loop.
-spp
--
Stephen P Potter [EMAIL PROTECTED]
"You can't just magically invoke Larry and expect that to prove your point.
Or prove that you have a point."-Simon Cozens
UNIX, Perl, PHP, Web C
e file printing all the lines after they've been worked
with (-pe). If a line starts with , the will be removed.
-spp
--
Stephen P Potter [EMAIL PROTECTED]
"You can't just magically invoke Larry and expect that to prove your point.
Or prove that
of the original file and a new file with the
changes.
-spp
--
Stephen P Potter [EMAIL PROTECTED]
"You can't just magically invoke Larry and expect that to prove your point.
Or prove that you have a point."-Simon Cozens
UNIX, Perl, P
Lightning flashed, thunder crashed and "Sascha Kersken" <[EMAIL PROTECTED]> w
hispered:
| DIR = opendir ("path/to/dir");
I think you mean 'opendir(DIR, "/path/to/dir");' not
'DIR = opendir("/path/to/dir");'.
-spp
--
Stephen
fails (if it isn't in
/usr/sbin, for example). This is not true though. Only by checking the
status of the close will you be able to determine this.
-spp
--
Stephen P Potter [EMAIL PROTECTED]
"You can't just magically invoke Larry and expect th
really is no
way to make a child affect its parent.
-spp
--
Stephen P Potter [EMAIL PROTECTED]
"You can't just magically invoke Larry and expect that to prove your point.
Or prove that you have a point."-Simon Cozens
UNIX, Perl, PHP, We
FOO, "foo" or die "Blah: $!\n":
open(FOO, "foo") || die "Blah: $!\n";
A lot of old timers (and/or C programmers) use the second form. 'or' is an
addition to perl 5 that earlier perl's didn't have, and that C doesn't
have. So, it
nates, the close() will happen automatically.
| open(APPEND,">>testfile") || die print "Can't open testfile: $!\n";
What is "die print"? You only need one of them.
-spp
--
Stephen P Potter [EMAIL PROTECTED]
"You c
igits (the last two are the
year), you can do something like:
$date = "010201";
substr($date, -2, 0, '20');
print $date;
This will print "01022001". What it is doing is replacing zero characters
at the -2 offset (2 from the end) of
ir(DIR, "/etc") do a chdir("/etc"), then
opendir(DIR, ".") to make sure that everything is working on the same
current directory.
-spp
--
Stephen P Potter [EMAIL PROTECTED]
"You can't just magically invoke La
.. as equal to
the first." What does this script do for you:
$first = ;
$second = ;
$third = ;
print "First: $first";
print "Second: $second":
print "Third: $third";
If I feed it "first", "second",
m the command line, it
will have your userid and your privledges. When it is run from the web
server, it will have the web server's userid and privledges (which is
usually different from your own).
-spp
--
Stephen P Potter [EMAIL PROTECTED]
"Y
to start with, your code should
look something like this:
usr lib '/home/luvz99/lib/perl';
use LWP::Simple;
$doc = get ($url);
Also, since LWP::Simple is part of the standard distribution, there
shouldn't really be any reason to have the use lib anyway.
-spp
--
Stephen P Potter
Lightning flashed, thunder crashed and Dave Neill <[EMAIL PROTECTED]> whispered:
| There's also:
|
| $foo =~ s/^\s*//;
You should always use /^\s+/. There's no sense in removing nothing if
nothing is there.
-spp
--
Stephen P Potter
o see
more code to be able to really tell you what is happening at this point.
-spp
--
Stephen P Potter [EMAIL PROTECTED]
"You can't just magically invoke Larry and expect that to prove your point.
Or prove that you have a point."-Simon
dynamically:
@a = qw/116 44 45 49 71/;
@b = qw/1 1 3 5 1/;
printf "%3d" x @a, @a;
print "\n";
printf "%3d" x @b, @b;
print "\n";
-spp
--
Stephen P Potter [EMAIL PROTECTED]
"You can't just magically invoke Larry a
iters:
if ($url =~ m|http://|i)
-spp
--
Stephen P Potter [EMAIL PROTECTED]
"You can't just magically invoke Larry and expect that to prove your point.
Or prove that you have a point."-Simon Cozens
UNIX, Perl, PHP, Web Consulting and Tr
| ;
I'm not sure where your confusion came from, but this is some kind of wierd
incest between shell and perl. You want to do some kind of string
comparison, such as:
if ($url eq "HTTP://";) {
or
if ($url =~ /http:/i) {
Your code should resemble this:
if ($url =~ /h
" by Robert Sebesta (ISBN
0139279555). It's nice and small and easy to get into.
I'm waiting to see a copy of "Learning Perl, 3rd edition" (Randal, HINT!).
I was disappointed with the second edition (I'll keep to myself how I think
it happened), but hold great hope
this would work for you:
while () {
if (/heading/) {
$variable = ;
}
}
-spp
--
Stephen P Potter [EMAIL PROTECTED]
"You can't just magically invoke Larry and expect that to prove your point.
Or prove that you have a point."
an up after yourself.
Line 8 checks to see if $text contains the two delimiters we're looking
for. Note the /s at the end to treat the string as a single line, ignoring
the newline characters during the match. Also note that we save the
formatted info
Lightning flashed, thunder crashed and "Bob Bondi" <[EMAIL PROTECTED]> w
hispered:
| So, simple on Unix/Linux! Are there any solutions via Perl to "touch" a
| binary file?
Unix doesn't differentiate between different types of files. They are all
just files. Perl is the same way. Do you want to
ind you have problems with 5.6.1, then send us some more
information about your particular system (OS, version, etc). It is
difficult to tell what might be the problem based solely on what you've
provided so far.
-spp
--
Stephen P Potter[EMAIL PROTE
Lightning flashed, thunder crashed and Erik W <[EMAIL PROTECTED]> whispered:
| Thanks a lot, then what << means?
| $$<<15 ???
It seems to me that you need to spend some time with a good beginners book,
such as Randal's. Or, at least, the man pages. These questions are easily
answered with a qui
Lightning flashed, thunder crashed and "Bob Bondi" <[EMAIL PROTECTED]> w
hispered:
| Yep, another newbie at Perl. I have come to a wall. What I need to do is
| open a file, find a value in the file and substitute a value.
| I've gotten to the point of what to do with an open file. I have been tryi
o numbers of roughly the same magnitude.
-spp
--
Stephen P Potter[EMAIL PROTECTED]
"You can't just magically invoke Larry and expect that to prove your point.
Or prove that you have a point."-Simon Cozens
http://www.unixlabs.net/~spp/
Lightning flashed, thunder crashed and Nichole Bialczyk <[EMAIL PROTECTED]> whispered
:
| i just wanted to let everyone know that i appreciate all of the time that
| you spent on me (especially today). my log script runs absolutely
| beautifully and my boss loves me! what else could i ask for?
Lightning flashed, thunder crashed and Nichole Bialczyk <[EMAIL PROTECTED]> whispered
:
| i'm sorry. i didn't think that you guys would want me to include my code.
| i just assumed that i should try to make my question to the point with as
| little text as possible. i am still having the same pr
Lightning flashed, thunder crashed and "Nichole Bialczyk" <[EMAIL PROTECTED]> whisper
ed:
| if(! open(LOG, ">xxx.txt)) {
I really hate to pick on you, but if you are going to provide sample code,
please make sure you are providing exactly what is in the script
(cut'n'paste as opposed to retyping)
Lightning flashed, thunder crashed and "King, Jason" <[EMAIL PROTECTED]
com> whispered:
| there are a number of HTML examples included with Perl
|
| perl/eg/IEExamples client-side PerlScript examples
| perl/eg/aspSamples server-side Perl/ASP examples
| perl/eg/Core/cgi server-
Lightning flashed, thunder crashed and "Kyrytow, Stefan" <[EMAIL PROTECTED]
m> whispered:
| Example.
| I am writing a script to parse a web log and report on all the hosts in the
| log.
| However I have a command line option to exclude a domain from the report.
| My problem is that I can't figure
Lightning flashed, thunder crashed and Peter Cornelius whispered:
| > Use:
| >
| > if (@ARGV and -T $ARGV[0]) { ... }
|
| Just wondering if there is a reason for using the lower precedence 'and'
| here instead of '&&'? I haven't been finding many uses for 'and' which
| tells me I might not f
Lightning flashed, thunder crashed and "prasoeu" <[EMAIL PROTECTED]> whispe
red:
| Hi,
| Somebody please tell me how to install perl DBI or mysql DBI, I have =
| download the modules.
Have you tried reading the README or INSTALL files? Generally, most
modules are fairly well behaved and "perl M
Lightning flashed, thunder crashed and Cameron Malchow <[EMAIL PROTECTED]> whis
pered:
| In unix, specifically OS X, if you have a perl program that is either binar=
| y
| or ascii how can you convert it to the opposite format?
Perl scripts are only in ASCII. It is possible, although it doesn't
Lightning flashed, thunder crashed and VeeraRaju_Mareddi <[EMAIL PROTECTED]>
whispered:
| Dear All
| I have a small with NET::PING.I hope its working by following command.
| USE NET::PING;
| But I am Not able to check remote connectivity of a host ("HOTNT002")
| through this NET function...I am
Lightning flashed, thunder crashed and "Rivera Alonso, David" whispered:
| I hope you won't hate me for this:
|
| after installing all the ".h" files under /usr/include, it goes much better,
| but I still have strange warning: when I say "make" it gives an error:
|
| "gcc: installation problem,
Lightning flashed, thunder crashed and "baby lakshmi" <[EMAIL PROTECTED]
> whispered:
| hi
| while doing ftp from windows to unix, the file contains ctl M at the end of
| each line. my file is a huge data file. i am not able to delete that. is
| there any better way to delete it.
| If anyone can
Lightning flashed, thunder crashed and chris brown <[EMAIL PROTECTED]> whispered:
| I would prefer to write each record using pack, but I
| can't see how to elegantly get pack to zero-fill
| without using sprintf. And I kind of feel like once
| I'm using sprintf I might as well ONLY use sprintf f
Exactly what is the problem that you seem to be having? This is a CGI
script that needs to be run from a web server. Do you have a web server
that you have cgi-bin access to? What doesn't work for you? This worked
just fine for me.
-spp
Lightning flashed, thunder crashed and Nichole Bialczyk
Lightning flashed, thunder crashed and "Brett W. McCoy" <[EMAIL PROTECTED]>
whispered:
| On Thu, 24 May 2001, David Matthew Monarres wrote:
| It's part of a standard Perl installation. Type 'perldoc gethostbyname'
perldoc -f gethostbyname will work better, since you are looking for a
function i
Lightning flashed, thunder crashed and Peter Cornelius whispered:
| The camel book suggests the following:
|
| #!/bin/sh --
| eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
| if 0;
|
| Is this the best alternative and are there situations in which it might not
| work?
The camel suggests this for
Lightning flashed, thunder crashed and "Rivera Alonso, David" whispered:
| I understand that it's searching for all those "*.h" mentioned in "perl.h".
| But, where should they be? I've installed gcc compiler, shouldn't it contain
| these files already? do I have to install C libraries or sthg?
Y
Lightning flashed, thunder crashed and "Craig Moynes/Markham/IBM" <[EMAIL PROTECTED]
bm.com> whispered:
| open ( ERR, ";
You are mixing things here you don't want to mix. This should just be:
while ($in = ) {
You *can* mix these, but there is no real reason to. Especially not in
your sample c
Lightning flashed, thunder crashed and "Kaustav Bhattacharya" whispered:
| open(BOOT_FILES,">boot_files.txt");
| print BOOT_FILES @FILES;
| close BOOT_FILES;
You should always check the return of open and close...
open BOOT_FILES, ">boot_files.txt" or die "Can't open boot_file
Lightning flashed, thunder crashed and "Collin Rogowski" <[EMAIL PROTECTED]> w
hispered:
| They exist both.
| chop removes the last character.
| chomp removes the last character if it's newline.
Let's get this straight and correct. chomp removes the input record
separator ($/). This may or may
There isn't a switch statement either. There's a way to make something
that looks similar to a switch, but it isn't a builtin control structure.
-spp
Lightning flashed, thunder crashed and "Kaustav Bhattacharya" whispered:
| Mark,
| I only recently started coding in PERL so don't take the foll
Lightning flashed, thunder crashed and Mark Martin <[EMAIL PROTECTED]> whisper
ed:
| What I have is this:
|
| if ($variable == 02){
| print OUT1 "$variable";
| $lines1 ++;
| } elsif($variable == 03){
| print OUT1 "$variable\n";
| $lines2 ++;
| } elsif($variable == "08"){
Lightning flashed, thunder crashed and "Sean O'Leary" <[EMAIL PROTECTED]> whisp
ered:
| split (/./, $ARGV[0], 5)
|
| I don't know what the 5 is doing there ( I think it should be a 4, because
| you are assigning the result of the split to 4 a list of variables, but the
| compiler knows about ma
60 matches
Mail list logo