bits of course)
so in short, try:
my ($d,$m,$y) = $string =~ /(\d+)(\D+)(\d+)/
\D is perfectly safe here, but tehn again, we know context... =)
hth,
Jos Boumans
snip
I stand by my reply to this post. Sure, unpack is quicker. But if you use
regex, i always prefer to use my own defined
i think what you really want to use then is chomp or a regexp..
or you'd have to say
print hello\n
print \b
print world
etc
hth,
Jos Boumans
Bob Mangold wrote:
Hello,
I know I can use the backspace character to overwrite previous characters and
the such, but can I use it to backup
Please use the the 'use lib' pragma, rather then fiddling with @INC
concider:
use lib (../foo);
rather than:
BEGIN: { push @INC, '../foo' }
perldoc lib for more info
hth
Jos Boumans
Maxim Berlin wrote:
Hello Dennis,
Tuesday, June 26, 2001, Dennis Fox [EMAIL PROTECTED] wrote:
DF
because push @INC is a runtime statement,
use lib is a compile time statement
meaning you'll be alerted if the dir doesnt exist, or something else goes wrong at the
moment you start your script, rather then it dying half way when not findin a file.
hth
Jos Boumans
Maxim Berlin wrote:
Hello
you might want to try to use 'chomp' on your variable... this function
is specifically there to 'chomp off' trailing newlines
you'll often see it used as:
open FH, 'foo.txt';
while(FH){
chomp; #remove trailing newline
do something
}
perldoc -f chomp for details
hth,
Jos Boumans
How do you mean?
concider:
if ('a' == 'b') { print foo } # this will print 'foo', seeing 'a' and 'b' both yield
'1' in numeric
context here.
however
$x = 'a';
print $x + 4;
will print '4';
Jos Boumans
Converting 'a' to a number gives 0.
--
Paul Johnson - [EMAIL PROTECTED]
http
for poining out the mistake
Chas Owens wrote:
On 27 Jun 2001 17:45:18 +0200, Jos Boumans wrote:
How do you mean?
concider:
if ('a' == 'b') { print foo } # this will print 'foo', seeing 'a' and 'b' both
yield '1' in numeric
context here.
You mean 0 not 1 don't you?
however
$x
and for esthetics:
print join ',' @array;
timtowtdi =)
John Edwards wrote:
$data = Sat Jun 23 01:07:31 2001,bytes=32,time=192ms,TTL=239;
@array = $data =~ /=(\d*)/g;
print $array[0], $array[1], $array[2]\n;
-Original Message-
From: Alex Nelson [mailto:[EMAIL PROTECTED]]
Sent:
if there is one
}
you can print them out as a csv file as follows:
for(@store){ print ( (join ',', @$_) . \n)}
this is a bit advanced regexes, but you can check out a tutorial on them at
www.sharemation.com/~perl/tut to give you an insight in them
hth,
Jos Boumans
Ken wrote:
One thing to do would
on that note, you can also use the getopt module, that lets you specify
switches like you're used to on any linux system as follows:
script.pl -i input.txt -o output.txt
look at perldoc getopt for a simple description
regards,
Jos Boumans
Brett W. McCoy wrote:
On Thu, 21 Jun 2001, Pedro
questions about it to the list
you can get the latest download from either sourceforge.net or from poe.perl.org
i recently made a ppm for windows to install the latest version, which should be
available for public download shortly as well
hth,
Jos Boumans
Rajeev Rumale wrote:
Dear Chas
maybe there's a more elegant way, but this will work:
open I, input.txt;
open O, output.txt;
while(I) { print O unless $. == $foo }
where $foo is the line number you dont want printed.
hth,
Jos Boumans
Stéphane JEAN BAPTISTE wrote:
HI.
I'm looking for a method to delete the line number
www.activestate.com is where you should look
hth,
Jos Boumans
Jude Suszko wrote:
I'd like to get my feet wet with a decent pre-built binary Perl
before I try building my own from sources. At the moment
I'm stuck with a Win98 SE platform to run it on. I found several
possibilities
try reading this article:
http://www.perl.com/pub/1999/10/DBI.html
hth,
Jos Boumans
Diego Riaño wrote:
Hi Everybody
I am trying to use de perl DBI module to use a MySQL database. I want to know
where can I find a tutotial or maybe a HowTo (I do not know?) about perl DBI
module?
Could
Assuming you'll utilise the CGI module, this would work:
my $q = new CGI;
my $calling_page = $q-referer();
hth,
Jos Boumans
Stéphane JEAN BAPTISTE wrote:
How can I get the URL which was calling my script (like
document.referrer in Javascript)
tks
a function filling it... if my assumption is true,
then you'd want something like this:
sub new {
my @Next = function();
my $self = {
@Next,
@_,
}
}
hope this helps,
Jos Boumans
PS, if you want to read more about
/pub/2001/01/poe.html
and of course, all contents, faqs, docs etc are available from poe.perl.org
Hope this helps,
Jos Boumans
Ronald J. Yacketta wrote:
Folks,
Can someone shed some light on using fork to spawn 2+ simultaneous process?
I am reading in allot of logfiles and splitting them
, which above
snippet shows you how to do...
and then it's as simple as doing the last step: do the request, get the
responce...
i hope this example shows you The Path To The Dark Side ;-)
Jos Boumans
Ela Jarecka wrote:
Thanks, at least I know that I am sending my XML properly.. But I still get
of option 2... the
worst of both worlds so to speak
last remark i want to make is that it's always good to run 'use strict' and force
yourself
to use lexicals (my'd vars).
hope this helps,
Jos Boumans
open (ACCS, C:\\Perl\\BioPerl-0.7\\Seqdata\\Accession.txt) or die can't
open Accessions file;
@ets
of package indication...
now, what you *really* want to do is package the config file and use exporter to
make sure you don't clobber namespaces, but that might be a bit advanced, so for
now, this should solve your problem
hope this helps,
Jos Boumans
Dianne Van Dulken wrote:
Hi all,
I
or checks, you could add an 'or die
file not created' or even eval it...
hope this helps
Jos Boumans
[EMAIL PROTECTED] wrote:
I'm trying to write a script that opens a file, then matches some
characters, and then writes the output to an HTML file on the fly.
Everything works except I also
Sounds like an error somewhere during your initial installation... i recall seeing
that happen more often on this list
you might want to concider checking the AS support pages, or mailing them your problem
hth,
Jos Boumans
[EMAIL PROTECTED] wrote:
Hi,
I did also try this but I get
Boumans
PS html tags end /tag
Chas Owens wrote:
On 12 Jun 2001 17:45:16 +0200, Jos Boumans wrote:
try this:
unless (/^[-\.\w]+$/) { print you cheater! }
this will check if from beginning to end of $_ it contains - . (not even sure
you need to \ the . ) or any word character (a-z A-Z
of $in... if you dont want that, set the 'my $in'
above the block, rather then in it
hth,
Jos Boumans
Me wrote:
Can anyone send me any solution
to read the paragraph from a text file?
To read paragraphs (delimited by one or more blank
lines (really blank, no spaces or tabs)), change
to the list, it would make it easier for us to indicate the
problem
hth,
Jos Boumans
Ela Jarecka wrote:
foreach my $item ( keys $reqrec-myflds ) { #line 26
...
}
I get an error:
'Can't locate object method myflds via package DataReq at makeReq line
26'
How should I indicate
the first tutorial (data structures) and the third
one (references)
i think they will clear up most of the confusion.
hope this helps,
Jos Boumans
Ela Jarecka wrote:
Unfortunately, it doesn't seem to work... :-(
My constructor:
sub new {
my $that = shift;
my $class = ref
.
good luck,
Jos Boumans
[EMAIL PROTECTED] wrote:
Hi,
Im trying to connect a perl program to a mysql database on my home computer
running win 2k. I can connect, but i have no idea of how to extract the
information out of tables using perl. I have a book about SQL, but it never
mentions
Give it an entry in the crontab
man cron
man crond
that should explain functionallity for you
good luck
Jos Boumans
Sanchit Bhatnagar wrote:
Hi,
Is there any way to automatically execute a cgi script in un*x on a preset delay,
say for ex. once every day at 0800hrs.?
thanks,
san.
login name is 'foo', your home dir will by default be, /home/foo
and the profile will be in the .profile file
now, this is no guarantee... maybe your sysadmin set up the box differently, or you
dont run redhat or, or or...
I hope this helps, if not, try a linux mailing list
Regards,
Jos Boumans
i'm not too fond of below suggestion's variable naming, but hey,
tmtowtdi here's my 2 bits:
my $foo = 'test case total : 32456 allocated : 12000 from tech';
my ($num1,$num2) = $foo =~ /(\d+).+?(\d+)/;
Good luck,
Jos Boumans
Aaron Craig wrote:
my $sLine = test case total : 32456
be
if($a || ($b = 2) ) { print foo }
alltho what jeff said is very true: use OR for strings... just like you should
use EQ rather then ==
Regards,
Jos Boumans
snip
Jeff Pinyan wrote:
On May 17, Doug Johnson said:
my $x = return;
if (($x = a) || ($x = test ) || ($x = return ) || ($x = x-retun
to exclusively tell
you where that file belongs to.
On a side note, should i be adressing this mail to Kevin or Sally?
regards,
Jos Boumans
Kevin Williams wrote:
Does anybody know what type a file with a .dat extension is?
I've come across them as backup files, but have found one in a perl script
file names
something like
if (/^[A-Z]+$/) {
do_your_stuff;
}
Try it out, see how far you get and feel free to ask if you get stuck!
Kind regards,
Jos Boumans
Porter, Chris wrote:
Any ideas???
-Original Message-
From: Porter, Chris
Sent: Tuesday, May
' book)
Both published by O'reilly...
If you want some tutorials, you might want to try MJD's site at
perl.plover.com or www.sharemation.com/~perl/tut for some really basic
tutorials.
Of course learn.perl.org also has some advice on which books to read and
such.
Hope that helps,
Jos Boumans
RS
like this:
@foo = (1,2,3,4,5,6,7,8,9);
bar(@foo[1..5]);
sub bar {
my @a = @_;
for (@a) {print}
}
#which will nicely print '23456'
I hope this will solve your problem for now...
Regards,
Jos Boumans
Paul wrote:
--- Gary Stainburn [EMAIL PROTECTED
Ok, it's hard to help you without knowing the exact error that is generated.
So it would help if you posted that too
furthermore, that bit of code seems to be in order then, altho the first in
..cgi?tickers=yyyrefresh=x shouldnt be there...
Regards,
Jos Boumans
Peter wrote:
yes
help you as such... i'd need to look at the entire
code for that i think
Regards,
Jos Boumans
Peter wrote:
i corrected the before tickers.
when i append the refresh=x, i get a software error:
Execution of cgi aborted due to compilation errors
without the refresh=x, the script runs fine
Stephane, what you are looking for is the LWP module.. it comes standard
with any ActiveState perl release but is not standard with Linux (or at
least RedHat)
try search.cpan.org if you need to obtain and look for LWP
you'll find the documentation very informational.
Regards,
Jos Boumans
38 matches
Mail list logo