> use File::Copy;
> copy "header.incl", \*STDOUT;
I like this, it's very clean.
Unfortunately I'm having trouble using it in a cgi script...
**
#!/usr/bin/perl -w
use File::Copy;
print "Content-type: text/plain\n\n";
copy "header.incl", \*STDOUT;
print "Mo
I'm trying to validate if a string contains \w and required atleas one
period (.)
This one check but does not require a period. Can someone change it please?
sub isValidDomain { return shift =~ /^[\w\.]{3,}$/ }
thanks,
-rkl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands,
>if (defined $x and length $x)
>
>So, is this the opposite?
>
>if (! defined $x and ! length $x)
I don't think so. It's basic Aristotelian logic and can be determined
by truth tables or testing. Questions are mere conjecture :)
The negative of a statement, A, is: not A. That can be writte
On Thu, Oct 02, 2003 at 07:41:41PM -0700, [EMAIL PROTECTED] wrote:
> unless understood, how about this.
>
> if (defined $x and length $x)
>
> So, is this the opposite?
>
> if (! defined $x and ! length $x)
Nope; now you've got a boolean logic problem.
Either of these would work, but unless() is
unless understood, how about this.
if (defined $x and length $x)
So, is this the opposite?
if (! defined $x and ! length $x)
-rkl
> On Thu, Oct 02, 2003 at 07:03:02PM -0700, [EMAIL PROTECTED] wrote:
>> > if (defined $x and length $x)
>>
>> So, is this the opposite?
>>
>> if (! defined $x and
"John W. Krahn" wrote:
>
> GöTz Verdieck wrote:
> >
> > I'm looking for a solution for the following problem:
> >
> > This is the list I have : $kommalist ="20,21,22,23,24,25,27,28,31,32,33";
> >
> > And I want to convert it into : $newlist ="20..25,27,28,31..33";
> >
> > So, I only want to combin
GöTz Verdieck wrote:
>
> Hi,
Hello,
> I'm looking for a solution for the following problem:
>
> This is the list I have : $kommalist ="20,21,22,23,24,25,27,28,31,32,33";
>
> And I want to convert it into : $newlist ="20..25,27,28,31..33";
>
> So, I only want to combine the elements if there a
On Thu, Oct 02, 2003 at 07:03:02PM -0700, [EMAIL PROTECTED] wrote:
> > if (defined $x and length $x)
>
> So, is this the opposite?
>
> if (! defined $x and length $x)
Nope; you've got a precedence problem.
unless( defined $x and length $x ) { }
--
Steve
--
To unsubscribe, e-mail: [EMAIL
> if (defined $x and length $x)
So, is this the opposite?
if (! defined $x and length $x)
or do I have to parenthesis
if (! (defined $x and length $x))
-rkl
> On Oct 2, [EMAIL PROTECTED] said:
>
>>To recap, I want to test if a var is undefined or ''.
>>
>> if(undefined $x && length($x)==0)
>
On Oct 2, [EMAIL PROTECTED] said:
>To recap, I want to test if a var is undefined or ''.
>
> if(undefined $x && length($x)==0)
There IS no 'undefined' function in Perl, and you don't want to use &&,
you'd want to use ||, since the empty string "" IS defined.
if (not defined($x) or length($x) =
James has my intention correctly:
my $x=0;
if($x) #this would return false which is NOT I was looking for.
To recap, I want to test if a var is undefined or ''.
Thus, this would be equivalent to my isNULL() approach?
if(undefined $x && length($x)==0)
thanks,
-rkl
>> -Original Message---
On Thursday, October 2, 2003, at 07:23 PM, LoBue, Mark wrote:
-Original Message-
From: James Edward Gray II [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 02, 2003 5:20 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: Testing Uninitialized Vars
On Thursday, October 2, 2003,
> -Original Message-
> From: James Edward Gray II [mailto:[EMAIL PROTECTED]
> Sent: Thursday, October 02, 2003 5:20 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: Testing Uninitialized Vars
>
>
> On Thursday, October 2, 2003, at 07:08 PM, [EMAIL PROTECTED] wrote:
>
>
On Thursday, October 2, 2003, at 07:08 PM, [EMAIL PROTECTED] wrote:
you mean $x=0; would be false?
Yep.
James
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
you mean $x=0; would be false?
> On Thursday, October 2, 2003, at 06:29 PM, [EMAIL PROTECTED] wrote:
>
>> Are you saying this would do everything that I want?
>>
>> #I'm considering undefined var and '' and 0s are the same thing.
>> if($x) ... true - do_something
>
> I said it would, if you don't
On Thursday, October 2, 2003, at 06:29 PM, [EMAIL PROTECTED] wrote:
Are you saying this would do everything that I want?
#I'm considering undefined var and '' and 0s are the same thing.
if($x) ... true - do_something
I said it would, if you don't mind 0 being false.
James
--
To unsubscribe, e-
Are you saying this would do everything that I want?
#I'm considering undefined var and '' and 0s are the same thing.
if($x) ... true - do_something
-rkl
> On Thursday, October 2, 2003, at 05:09 PM, [EMAIL PROTECTED] wrote:
>
>>> if ( ! defined $x )
>>
>> I read up on defined and undefined. But
All this is in the same paragraph of oreilly Programming perl page 100 -
pub in 1991. I guess it is kinda old. Anyway, it actually says "...more
efficient..."
But I'm still sticking with showarg(); style too.
-rkl
>> But Orielly says showargs() is slower than showargs
>
> That's a good point, an
On Thursday, October 2, 2003, at 05:09 PM, [EMAIL PROTECTED] wrote:
if ( ! defined $x )
I read up on defined and undefined. But I'm looking for a test that
will
this return true or false to a var condition:
perldoc -f defined
perldoc -f undef
The second is a little different than what you thin
Using unlink may do what you want...and more in terms of unexpected side
effects later on that could have dire consequences.
For that reason on most Unix systems the use of unlink (and unlink())
requires root access and the use of rmdir (and rmdir()) is strongly
encouraged because it permits only
> But Orielly says showargs() is slower than showargs
That's a good point, and something I didn't know.
...I'm not sure if it will make me change my ways though.
Do you know where you read that? I'm not sure why it would be slower, I
would think that this would be optimized when the code is com
I agree it looks like the best standardized candidate for use.
But Orielly says showargs() is slower than showargs when not passing
arguments. It's just a minor point but its something I read.
In any case, I'm used to the showarg() style.
thanks,
-rkl
>> showargs();
>
> I like this one. It's th
> if ( ! defined $x )
I read up on defined and undefined. But I'm looking for a test that will
this return true or false to a var condition:
...
sub isNULL
{
return undefined $_[0] && $_[0] eq '' $_[0] eq "";
}
# my goal is all three return the same as
# my proposed sub isNULL()
my $x;
On Thursday, October 2, 2003, at 04:54 PM, Dan Anderson wrote:
Is there a way to match a question mark using a regular expression
without looking for a \X{3F} ?
~> perl -e 'print "Matched a ?\n" if "A question?" =~ /\?/'
Matched a ?
James
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For addition
--On Thursday, October 2, 2003 17:54 -0400 Dan Anderson
<[EMAIL PROTECTED]> wrote:
Is there a way to match a question mark using a regular expression
without looking for a \X{3F} ?
Just escape it: \?
Daniel T. Staal
---
This email copy
Thank you for all of the responses to my date/time problem. I have
rewritten the routine with the information and feel confident it is far,
far better than what I had.
Thanks...
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Is there a way to match a question mark using a regular expression
without looking for a \X{3F} ?
Thanks in advance,
-Dan
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
My preference...
> &showargs();
Ick. I use this one when it is required (references and overriding
prototypes), otherwise it isn't what I mean. If I mean to just execute the
method, then I don't use it.
> showargs;
Yuk. It saves a few keystrokes, but I tend to avoid it.
> showargs();
I lik
--On Thursday, October 2, 2003 14:31 -0700 A L <[EMAIL PROTECTED]>
wrote:
@1@2@3
item1aitem1bitem1c
item2aitem2bitem2c
. . .
. . .
. . .
They all have an equal number of items. I
A L wrote:
> Thanks for helping me on my previous question; I was able to get it
> afterwards. I have another question. First, I have 3 arrays and
> wanted to print out the items of corresponding places in a
> sequential order. I have tried using foreach function, like
>below forea
On Thursday, October 2, 2003, at 04:31 PM, A L wrote:
Thanks for helping me on my previous question; I was able to get it
afterwards. I have another question. First, I have 3 arrays and
wanted to print out the items of corresponding places in a sequential
order. I have tried using foreach f
Thanks I understand what you're saying.
If I could ask, which one of these would you use?
> &showargs; #NOT this is the tricky
> &showargs();
> showargs;
> showargs();
thanks,
-rkl
> [EMAIL PROTECTED] asked:
>> Here's an excerpt about the & from orielly and what the heck
>> does it means:
>>
Close, not quite. The "quantifier" (i.e. ?,+,*) appear AFTER the "atom"
(i.e. char or special symbol).
The syntax is also off a bit. It should be =~ and /../ (not single ticks).
$result =~ /^ *-?[0-9]+[.]?[0-9]* *\$/;
^ = beginning of line (also called an anchor)
* = zero or more spaces (no
Thanks for helping me on my previous question; I was able to get it afterwards. I
have another question. First, I have 3 arrays and wanted to print out the items of
corresponding places in a sequential order. I have tried using foreach function, like
below
foreach $a (@1){
foreach$b (@2){
On Thursday, October 2, 2003, at 04:25 PM, [EMAIL PROTECTED] wrote:
I wan to write a sub return true or false if the var was initialized.
We can do that, but I really don't think we need a sub for it, since
there is a built-in.
Can someone correct this sub or is it good?
No, I wouldn't call it
I wan to write a sub return true or false if the var was initialized.
Can someone correct this sub or is it good?
...
if(isNULL($x) { print "it is null\n");
else { print "it is NOT null\n");
...
sub isNULL
{
return $_[0] =~ //
}
thanks,
-rkl
--
To unsubscribe, e-mail: [EMAIL PR
I am using Perl's Spreadsheet Module to write a nicely formatted Report. Now the
customer want to convert it into "HTML" format, keeping the same formatting.
I was wondering if there is a module or something which will convert the original
Excel Spreadsheet and convert into HTML.
I know
Howdy:
I have a statement and I'm trying to see if
I understand what it is really is doing (not my code).
The code does this:
[snip]
result ~ '^ *-?[0-9]+[.]?[0-9]* *\$'
[/snip]
I break out the meaning as this:
[snip example]
^ = beginning of line plus a white space
*- = everything up to,
Suggest also that you talk with your network and novell admins to find
out how authentication is mapped from the novell server to the win2k
server. Based on my experience with nfs and samba that could result in
the loss of visibility of novell file ownership - for example on an nfs
share all file
GöTz Verdieck wrote:
> Hi,
> I'm looking for a solution for the following problem:
>
> This is the list I have : $kommalist ="20,21,22,23,24,25,27,28,31,32,33";
>
> And I want to convert it into : $newlist ="20..25,27,28,31..33";
>
> So, I only want to combine the elements if there are more tha
Josimar Nunes de Oliveira wrote:
> Hi Michel,
>
> Thanks for your help, but the code will run on windows2000server and the
> mapped drive points to a folder on novell server.
> The "getpwuid" is unimplemented in windows2000server perl.
> I would like to take the file´s ownership related to novell
> -Original Message-
> From: Charles K. Clarkson [mailto:[EMAIL PROTECTED]
> Sent: Thursday, October 02, 2003 4:42 AM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: RE: problem with date routine
>
>
> perlwannabe <[EMAIL PROTECTED]> wrote:
> :
> : I have a relatively simple script
On Thu, 2 Oct 2003, Todd Wade wrote:
>
> "R. Joseph Newton" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Todd Wade wrote:
> >
> > > I'm willing to pester the site owners to let you do the site. But it
> will
> > > probably take more than just you and I. The lack of responses t
On Thu, Oct 02, 2003 at 05:17:34PM +0200, Thomas B?tzler wrote:
> Todd Wade <[EMAIL PROTECTED]> wrote:
> > "Gary Stainburn" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > print while();
>
> This is bad because it first pulls in the file to
> build the list.
It doesn't. The
Joshua Colson [mailto:[EMAIL PROTECTED] suggested:
> sub load_file {
> my($file,$html) = shift;
> $html = '';
> open(FILE, "$file") or die "Cannot open $file for reading: $!"
> while() { $html .= $_; }
> return $html;
> }
Instead of "while() { $html .= $_; }", you
could use "$html = join
Todd Wade <[EMAIL PROTECTED]> wrote:
> "Gary Stainburn" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
[...]
> > One thing you forgot was to close the file. Also, don't
> > forget that you can do it with less typing:
Closing files is optional in Perl ;-) Filehandles
will either b
> "Bryan" == Bryan Harris <[EMAIL PROTECTED]> writes:
Bryan> What I'm interested in is what's the easiest way to print the
Bryan> contents of a file? For example, if I want to output my header
Bryan> file, "header.incl", how can I print the contents of that file
Bryan> the easiest (and most g
Paul Kraus wrote:
> Not running cygwin.
>
> This works but still requires I redirect to a text file first.
>
> I want to be able to pipe.
>
> Perldoc -f localtime | command
> Then have it just dump to the usb printer.
This should work (assuming ActiveState)
C:\> perl c:\perl\bin\perldoc.bat
# Set $header_file to the PATH to header.incl
my $header_file = 'header.incl';
# Call load_file() which takes a filename as an argument and
# returns the contents of that file. Then print what load_file()
# returns.
print load_file($header_file);
sub load_file {
my($file,$html) = shift;
$html
Not running cygwin.
This works but still requires I redirect to a text file first.
I want to be able to pipe.
Perldoc -f localtime | command
Then have it just dump to the usb printer.
-Original Message-
From: TN [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 02, 2003 10:28 AM
To:
"R. Joseph Newton" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Todd Wade wrote:
>
> > I'm willing to pester the site owners to let you do the site. But it
will
> > probably take more than just you and I. The lack of responses to your OP
> > might indicate the amount of help the r
> Has anyone done this in Perl, is there an module that can
> help me? I am aware of that I can use the Win32::Ole, but
> what I really want is an more easier way of asking:
use Mail::Internet;
my $mail = Mail::Internet->new(\*STDIN); # see docs on how to use an array instead of
a file handle
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Todd Wade) writes:
>
>"Gary Stainburn" <[EMAIL PROTECTED]> wrote in message
>news:[EMAIL PROTECTED]
>> On Thursday 02 Oct 2003 10:25 am, Owen wrote:
>> > On Wed, 01 Oct 2003 23:14:00 -0700
>> >
>> > Bryan Harris <[EMAIL PROTECTED]> wrote:
>> > > W
Hi,
I'm confused by the listing of your crontab. Anyway, script A seems to
be working ok. The problem seems to be with script B. But is this
true? The snoop manpage (for Solaris 8, see
http://docs.sun.com/db/doc/806-0625/6j9vfim06?q=snoop&a=view) says that
"snoop requires an interactive interfa
> Hi,
Howdy
> I'm trying to write a CGI script to upload a file from a
>
> #!/usr/bin/perl -w
> use strict;
> use CGI qw/:standard/
> print "Content-type: text/html\n\n";
>
> print $query->filefield('uploaded_file');
> $filename = $query->param('uploaded_file');
> $fh = $query->upload('u
To print from cygwin avoiding the DOS window try:
cmd /c "start /min notepad /P "
This will print to the default printer which can be a USB printer.
does not need a .txt suffix.
-tristram
-Original Message-
From: TN [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 02, 2003 9:45 AM
T
"Gary Stainburn" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Thursday 02 Oct 2003 10:25 am, Owen wrote:
> > On Wed, 01 Oct 2003 23:14:00 -0700
> >
> > Bryan Harris <[EMAIL PROTECTED]> wrote:
> > > What I'm interested in is what's the easiest way to print the contents
of
> > >
Hi and Help,
I have a perl script (A) that spawns a unix command and pipes that to a log file. Then
at 23:59 I have a perl script (B) that kills script (A). At midnight script (A) is
kicked off.
My issue is my killing of srcipt (A) is not working. It either is showing under ps,
but not doing
In DOS you can run
start /min notepad /P
I've tested it and it works.
This will print a text file even without having a .txt suffix
With my cygwin setup
notepad /P
Works but a DOS window flashes for a split second before printing. Not
sure where the DOS start command is, but by putting th
James Edward Gray II wrote:
> On Wednesday, October 1, 2003, at 04:34 PM, McMahon, Chris wrote:
>
> > But Perl doesn't come with OSX by default. You may or may not have
> > an install CD called "Developer Tools" or some such, and Perl is on
> > that.
>
> At the risk of sounding like a brok
Hi,
I would not try to understand the problem too much, but instead just get
rid of it and improve the perl environment on your server.
To do this I suggest that you upgrade to a late version of perl. You
can get sources for 5.8.1 from
http://www.perl.com/pub/a/language/info/software.html and bu
Kind of off topic.
How can you redirect to a usb printer from the shell in windows xp?
Its getting really irritating having to perldoc -f function >
function.txt
Open function.txt in notepad and then print.
Thanks,
Paul
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-
Hi all,
May I start by thanking all the people who have helped me in the past, and I
hope you can help me with this one.
I have a Solaris 5.8 server with a version of Perl provided as part of
Rational ClearCase, and I am getting very strange errors. Sometimes scripts
fail when use'ing Getopt::L
perlwannabe <[EMAIL PROTECTED]> wrote:
:
: I have a relatively simple script that needs to get
: two separate dates, today's date, and yesterday's
: date. The dates are in mmddyy format.
: Here is the script:
:
:
: ## BEGIN SCRIPT
: my ($mday,
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 u
[EMAIL PROTECTED] asked:
> Here's an excerpt about the & from orielly and what the heck
> does it means:
>
> "...If a subroutine is called using the & form, the argument list is
> optional. if ommitted, no @_ array is setup for the routine;
> the @_ array at the time of the call is visible to su
On Thursday 02 Oct 2003 10:25 am, Owen wrote:
> On Wed, 01 Oct 2003 23:14:00 -0700
>
> Bryan Harris <[EMAIL PROTECTED]> wrote:
> > What I'm interested in is what's the easiest way to print the contents of
> > a file? For example, if I want to output my header file, "header.incl",
> > how can I pri
[EMAIL PROTECTED] wrote:
>
> Here's an excerpt about the & from orielly and what the heck does it means:
>
> "...If a subroutine is called using the & form, the argument list is
> optional. if ommitted, no @_ array is setup for the routine; the @_ array
> at the time of the call is visible to sub
On Wed, 01 Oct 2003 23:14:00 -0700
Bryan Harris <[EMAIL PROTECTED]> wrote:
>
> What I'm interested in is what's the easiest way to print the contents of a
> file? For example, if I want to output my header file, "header.incl", how
> can I print the contents of that file the easiest (and most gen
Hi,
I'm looking for a solution for the following problem:
This is the list I have : $kommalist ="20,21,22,23,24,25,27,28,31,32,33";
And I want to convert it into : $newlist ="20..25,27,28,31..33";
So, I only want to combine the elements if there are more than two like
20,21,23
Any hint or code
Perlwannabe wrote:
>
> I have a relatively simple script that needs to get two separate dates,
> today's date, and yesterday's date. The dates are in mmddyy format.
> Everything works great on days 2 - 31 of the month, but on the first of
> the month yesterday's date is not correct. For example,
"John W. Krahn" <[EMAIL PROTECTED]> writes:
> [EMAIL PROTECTED] wrote:
> >
> > Can I do something like this?
> > from
> > $sth = getVUser($dbh, $u, $d);
> > return $sth->rows();
> > to
> > return (getVUser($dbh,$u,$d))->rows();
I find this more readable
return getVUser($dbh,$u,$d)->rows();
Here's an excerpt about the & from orielly and what the heck does it means:
"...If a subroutine is called using the & form, the argument list is
optional. if ommitted, no @_ array is setup for the routine; the @_ array
at the time of the call is visible to subroutine instead."
So, is there a bett
Generally the use of the ampersand in subroutine calling is considered a bad
habit even though it will work for most subs. For one thing, a sub called
with the ampersand ignores any subroutine prototyping. As far as the
parentheses go, I always use them even if there is nothing being passed
beca
Is it really bad practice oneway or another with calling sub?
&doMe;
&doMe();
doMe;
doMe();
Please explain in terms of performance and practice.
thanks,
-rkl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
both of these works:
>> return (getVUser($dbh,$u,$d))->rows();
and
return getVUser($dbh,$u,$d)->rows();
-rkl
> [EMAIL PROTECTED] wrote:
>>
>> Can I do something like this?
>> from
>> $sth = getVUser($dbh, $u, $d);
>> return $sth->rows();
>> to
>> return (getVUser($dbh,$u,$d))->rows();
>
[EMAIL PROTECTED] wrote:
>
> Can I do something like this?
> from
> $sth = getVUser($dbh, $u, $d);
> return $sth->rows();
> to
> return (getVUser($dbh,$u,$d))->rows();
What happened when you tried it?
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For a
77 matches
Mail list logo