Dan,
One thing that springs to mind is that if you're using Windows, you can't
specify -w on a she-bang (well you can, but windows aint gonna do anything
with it). Using warnings.pm would force this in the script, rather than
relying on you webserver, whatever's calling you scripts.
Hope this hel
How about this case sensitive solution
===
#!perl -w
use strict;
my ($file_name, $search_string) = @ARGV;
open(INFILE, "< $file_name") or die "Couldn't open $file_name for reading:
$!\n";
while () {
if ($_ =~ m/\Q$search_string\E/) {
print "yes";
exit();
}
}
print "no";
Hi Guys,
According to my bookshelf, from 5.004 onwards srand uses a seed that's
"that's reasonably difficult to guess". Prior to that, it used time(). It
does seem as if the seed it being set the as the same value each time. Could
your program be being cached some where?
Otherwise a suggestion fo
Do I get marks for this then?
"Jeff Westman" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Sounds like a class homework assignment to me ;-)
>
>
> >
> > what code do you have so far? or are you having trouble getting started
?
> >
> --- "Kipp, James" <[EMAIL PROTECTED]> wrote:
> >
Hi Jaws (!?),
You don't say where your script is failing, or what errors it's reporting,
which is going to make it hard for anyone to help. You could add some better
error checking. Here's a couple of lines lifted from one of my CGI's.
my $dbh;
eval { $dbh = DBI->connect( $DATA_SOURCE, $DB_USER,
t;> line 1.
> [EMAIL PROTECTED] util]#
>
> That's the error message of the program.
>
>
> At 08:54 AM 3/28/2003 +, Rob Anderson wrote:
> >Hi Jaws (!?),
> >
> >You don't say where your script is failing, or what errors it's
reporting,
> >
I'm trying cache a function to help speed it up. My function lives inside a
module, and is being called from a seperate script. It works if I do the
following.
foreach my $count (1..10) {
print "$count" . test("one") . "\n";
}
print "\n";
-- module sub routine
sub test {
my
Thanks but I don't see how this could work. I've tried using it, but to no
avail
"Janek Schleicher" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Rob Anderson wrote at Fri, 28 Mar 2003 14:45:07 +:
>
> > -- module sub routine ---
Buy "Learning Perl" by O'Reilly, it's great.
HTH,
Rob
"Ohad Ohad" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> hey,
>
> I guess this question came up several time already so a link will be fine.
>
> What is the best way to learn Perl for someone with very basic programming
> sk
sName, $comm, $sysoid, $pollint, $pollYN) = @arr;
>print ("\t$dnsName, $comm, $sysoid, $pollint,$pollYN\n");
>}
HTH
Rob Anderson
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Hi Paul,
"Paul Morris" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi
>
> #!/usr/bin/perl
> use strict;
> $a = 123; #slips through strict
> $b = 123; #slips through strict
> $c = 123; #caught by strict
>
> Is there any reason (apart from convenience) why 'a' and 'b' should ge
#x27;tasty', 'cheese');
my $escaped_array = join(",", map {$_ =~ s/,/\\,/g; $_} @array);
my @restored_array = map { $_ =~ s/\\,/,/g; $_ } split(/[^\\],/,
$escaped_array);
print $restored_array[0] . "\n";
OUTPUT
tast
Thanks for any help
Rob A
Hi Hamish,
You might well ask, "what's the difference between...
print 1 + 2 * 3;
...or...
print 1 + (2 * 3);
...?"
The answer to this, and to your question is, not a lot.
Sometimes you do need to add parenthesis to resolve ambiguities over what's
dereferencing waht, but in your case you, m
Hi err, Mr T.
Here's a solution to your question, but from a different point of view...
--
#!perl -w
use strict;
my $im_thinking_of = int(rand 10);
my $guess;
do {
print "Pick a number:";
$guess = ;
chomp $guess;
if ($guess > $im_thinking_of)
Hi Rob,
No, you're not heading down the wrong path, you just need the Oracle
**client** installed on your local machine.
When recompliling DBI and DBD make sure you've got the following set
correctly (appropriate to your set up) ...
ORACLE_HOME=/export/home/oracle/OraHome1
PATH=$PATH:/export/hom
"Robin Garbutt" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
what does shift do in perl?
cheers
Rob.
> -Original Message-
> From: Janek Schleicher [mailto:[EMAIL PROTECTED]
> Sent: 23 June 2003 08:52
> To: [EMAIL PROTECTED]
> Subject: Re: perl reg exp problem
>
>
> Robin
Opps double clicked first time round, I blame my mouse :-)
Robin, perl has online documentation for all it's functions and much more.
try the following
perldoc -f shift
and
perldoc perldoc
for more general advice
HTH
"Rob Anderson" <[EMAIL PROTECTED]> wrote in message
Hi Anthony
>"Anthony Beaman" <[EMAIL PROTECTED]> wrote in message
>news:[EMAIL PROTECTED]
>Hi! I'm still wallowing in Chapter 3 (Arrays. Why can't I get it?!?!?!?
ARGH!) of Learning Perl on >Win32 Systems. I'm trying to create an
exercise but I'm not getting the results that I want. Here's wha
>"Anthony Beaman" <[EMAIL PROTECTED]> wrote in message ?
>news:[EMAIL PROTECTED]
>I typed in 3. For example, "Sam Mary Joe". I expect to get "I know Mary",
since she's [1] but I'm getting
>a blank space. I've tried this on NT and on my 98 machine here at work.
Hmm, are you just putting spaces bet
This is a snippet from an cgi based file uploader I wrote once. I think this
is what you're after
#/!perl -w
use strict;
use IO::File;
my $offset = 3;
my $file_binary = "fg";
sysopen(OUTFILE, "out.txt", O_WRONLY) or print "Couldn't open file for
read/write ($!)\n";
binmode OUTFILE;
sysseek OUTFI
Hi Again,
You're right, if we were dealing with a text file, you wouldn't have to use
binmode. However, my original script **was** for uploading binarys, and you
mentioned mp3, so it made sense to leave it in.
Hope I've been of some help
Rob
"Li Ngok Lam" <[EMAIL PROTECTED]> wrote in message
ne
t it out, put deferencing
it to an array by prefixing it with a @.
You could also do this...
my $inner_array_ref = $var[0];
print $$inner_array_ref[1];
Which will print the second element from the inner array.
You'd be well advised to read up on references, and de-referencing stuff.
HTH
Rob Anderson
> ~Sitha
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
"Rob Anderson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> "Sitha Nhok" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Hi, if I have a multidimensional array like :
> >
> > @AoA = (
> >
Hi Bill,
I know you've had lots of comments on this, but I thought I'd throw my own
style in. Why not do your check at the bottom with a "do until"? First time
round the check is useless anyway, and will give you 'undef' type warnings
with perl -w. It also allows you to be more positive in your co
is key
if (! defined $data{$key}) {$data{$key} = []}
my $array_ref = $data{$key};
push(@$array_ref, [EMAIL PROTECTED]);
}
Hope this helps
Rob Anderson
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
"Sudarshan Raghavan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Rob Anderson wrote:
>
> >Hi Jeroen,
> >
> >
> >
> >>while (@values = $lcsr->fetchrow) {
> >>
> >>
> >
> >This is probably th
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
>
> We are having a problem. Any help would be appreciated.
>
> 1: We are running Perl on NT.
> 2: Perl is reading lines of code from a file, concatonating it in a
variable,
>and writing to an Oracle database.
> 3: I keep on getting a
"Sudarshan Raghavan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Rob Dixon wrote:
>
> >I was perturbed by your post Sardushan. I'll
> >try to explain why.
> >
>
> Wait a second, my post was not an attempt to undermine Rob Anderson's
> post in any manner. I apologize if the wrong
"Ned Cunningham" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> HI all.
>
> I am trying to verify that a field has only numbers
>
> 12345
> 13456
> 34x34
>
> if it has non numbers I want to delete the non number with a zero?
>
> Snip
>
> $mil =~ s/[0-9]/$_/;
>
> this returns zero.
>
Hi Rajeev,
I'm not sure why you feel the need to join your buffer into a big string.
>From what you describe couldn't you just process each buffer element one by
one?
foreach my $buffer_entry (@buff) {
if($buffer_entry =~ /(FastEthernet|down)/i) {
print $buffer_entry;
}
}
Let us
"Paul Archer" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
[snip]
>
> If anyone can offer general improvements to that approach, that'd be
> great--but what I'm really interested in is finding the first element that
> differs, and maybe the last as well. If there were any easy way
Hi Paul
"Rob Anderson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> "Paul Archer" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>
> [snip]
>
> >
> > If anyone can offer general improvements to that ap
a string of characters that
> have--but it's still a good reference.)
>
> Thanks again,
No prob, glad to be of help.
Rob
>
> paul
>
>
> 10:11am, Rob Anderson wrote:
>
> > > If anyone can offer general improvements to that approach, that'd be
trying to parse it yourself? If
you've got control of your data, use something like Text::CSV. The guy who
maintains your code will thank you for it.
otherwise, this seems to work (you'll have to print with $2 though)...
/(['"])(((''|"")|[^'"
7; 'data13'
>
>I will have a look at Text::CSV
>
Please do, my mistake above shows you why you shouldn't reinvent this stuff
if you can
get away with it. :-)
Ta
Rob
>
>Michel
>
>-Message d'origine-
>De: Rob Anderson [mailto:[EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
"Kurt Klinner" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello,
>
> while trying to parse a "large" XML document i found a
> strange behaviour of the Parser Module(s) (XML::Parser:PerlSAX,
> XML::Parser, XML::Parser::Expat
>
> If my file XML file is larger then 65536 bytes
> th
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> What is the function of cutting a string from a point until the last
character?
>
> For example
> $string="C:/progra~1/directory1/directory2/file.txt";
>
> i want to find the last backslash (/) of the string and keep the sequence
> foll
r paramters you might pass.
What you were doing was getting the value from an array on scalar context.
When you do this in perl, it will return the __number of elements__ in the
array, which is very usefull, but not what you wanted. For example.
my $number_of_element = @a_big_array;
HTH
Rob A
>"Mark Weisman" <[EMAIL PROTECTED]> wrote in message
>news:[EMAIL PROTECTED]
>How do you capture passed parameters in Perl on Windows? In regular perl
>its:
> $variable = param('passed');
Hi Mark,
Erm, are you talking about passing parameters on the command line or to a
cgi.
if you calling pe
>""Freddy söderlund"" <[EMAIL PROTECTED]> wrote in
> message news:[EMAIL PROTECTED]
>Hi!
>
Hi
>I have stuck my thoughts on this one, maybee someone can help me out?
>
>I have two arrays
>
>@array1 = "C:\Program files\directory1\directory2\directory3";
>@array2 = "C:\Program files\directory1\dir2
""Freddy söderlund"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> - Original Message -
> From: "Rob Anderson" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, September 04, 2003 3:30 PM
>
"Anthony J Segelhorst" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Does anyone already have a perl script that checks to see if a file exists
> or not a Windows Platform?
>
if (-e $filename) {print "There it is\n"}
>
> Anthony J Segelhorst
> Enterprise Systems Management Team
>
"Pandey Rajeev-A19514" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi ,
Hello
>
> I need some help me to extract a pattern. The delimiters is a pair of
"abcd" and "efgh". Can some one help me with an efficient use of Greedy and
non greedy matches, look ahead and lookbehind feat
43 matches
Mail list logo