Using regexp to get a substring

2002-01-06 Thread David
Hello All, I am beginner and need some helps. Thanks a lot! The question is, if I have a string, for example "C:\PerlScripts\TestSamples\StringTest.pl", how do I use regexp to parse this string and get substring after the last backslash ("StringTest.pl"). Thanks in advanc

writing to a .txt file issues

2008-10-09 Thread David
My simple program works well in the terminal window: #!/usr/bin/perl -w use strict; my $answer; for ($a = 1; $a <= 100; $a++) { for ($b = 1; $b <= 100; $b++) { $answer = ($a-$b); print "$a - $b\t$answer\n"; } } Output: 1 - 1 0 1 - 2 -1 1 - 3 -2 1 -

Re: writing to a .txt file issues

2008-10-09 Thread David
Try taking away the "+" in your filehandle line, so that it reads: open (WRITE,">/Users/dave/Documents/Programming/Perl/081008mathables/add.txt"); No, that didn't work. Program changed to: #!/usr/bin/perl -w use strict; my $answer; open(WRITE,">/Users/dave/Documents/Programming/Perl/081008ma

Re: writing to a .txt file issues

2008-10-09 Thread David
Thank you, everyone who helped me. I greatly appreciate this. -David -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

system -> $variable

2008-11-29 Thread David
nceivable combination of backticks and double quotes allowable. I'm quite stuck. -David -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

"df -mg" system() -> $variable

2008-12-01 Thread David
llow the Learning Perl code. It's just not working for me. -David -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: "df -mg" system() -> $variable

2008-12-01 Thread David
t;' sh: -c: line 1: `(df -mg;) ">/Users/mini/diskSpaceLog/081201 diskSpace.txt" &' -David -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: "df -mg" system() -> $variable; solution

2008-12-02 Thread David
Thanks to all the input. I learned... what more I have to learn. Here is the final working perl script that sends the current "df -mg" command to a text file for daily logging. -David #!/usr/bin/perl -w use strict; use warnings; my $dayStamp = do { my ( $day, $mo

Re: Inserting chr(27) at the beggining of a text file

2004-03-01 Thread david
a]# perl -i -pe 'printf "%c**", 27 if $. == 1' tmp.txt [panda]# od -c tmp.txt 000 033 * * a b c d \n 010 here i am adding a ESC followed by '*' and '*' to tmp.txt. od is used to verify the file before and after the addition david -- s$s*

Re: trouble with writing to file

2004-03-01 Thread david
; no. it won't break capturing. you get undef simply because your regex doesn't match: 20040301-www.tgz you want: /^(\d+)-www\.t(?:ar\.)?gz/i; david -- s$s*$+/http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: remove '\' with new-line

2004-03-02 Thread david
ord(10)' 49 [panda]# perl -e 'print chr(10)' [panda]# you want chr(10): [panda]# cat dfile \abcd\xxx\yyy\ 1234\zzz [panda]# perl -pe 's.\\\n.\n.g' < dfile \abcd\xxx\yyy 1234\zzz [panda]# perl -pe 'BEGIN{$n = chr(10)} s.\\$n.$n.g' \abcd\xxx\yyy 1234\zzz david -- s$s*$+/http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: Only reading even lines in file -skipping odd ones!

2004-03-02 Thread david
ot;Can't create $mess: $!\n"; notice this improve readability and consequencely maintainability. > > > while () > { > you got a line from the input file and store it in $_ but you never use $_ in your script which means the line is discarded > > chom

Re: Problm encountered in using DBI

2004-03-04 Thread david
en i searched for it, i was not able to find it. > Perl is saying it can't find Oracle.so. did you install the Oracle client libraries? if you haven't, you need to. you have a very old Perl, you should consider upgrading that as well. david -- s$s*$+/http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: installing perl 5.8

2004-03-05 Thread david
likely fail to work and you must recompile and reinstall them. modules that are pure Perl should continue to work. david -- s$s*$+/http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: Code Socket Port... Read In and sent out to perl script

2004-03-05 Thread david
are created (by the server) from file.1, file.2 and file.3 respectively. i have omitted some error checking code for simplicity. you should add them when you are coding for production. you can easily modify the client to accept the following calling convention that you required: cat file | client.p this is left as an exercise for you ;-) david -- s$s*$+/http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: Code Socket Port... Read In and sent out to perl script

2004-03-05 Thread david
erent EOL sequence. when this happen, the client process won't return so when you fork again, the number of process will keep going up which will eventually fill up the process table and crash the machine. david -- s$s*$+/http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: Variable matching.....

2004-03-09 Thread david
t match\n"; } __END__ prints: match it will fail for the number 0 david -- s$s*$+/http://learn.perl.org/> <http://learn.perl.org/first-response>

RE: urgent need for installing perl 5.8.0

2004-03-10 Thread david
ound > No error definitions found at Errno_pm.PL line 180. > make[1]: *** [Errno.pm] Error 1 > make[1]: Leaving directory `/perl-5.8.0/ext/Errno' > make: *** [ext/Errno/pm_to_blib] Error 2 > what's your configure command? make can't find cc which means you eithe

Re: second-level string interpolation

2004-03-12 Thread david
cribe, i don't see any reason this can't be done: #!/usr/bin/perl -w use strict; my $s =<<'CODE'; I want to say: $v CODE my $v = 'hello world'; print eval qq.qq,$s,.; __END__ prints: I want to say: hello world david -- s$s*$+/http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: second-level string interpolation

2004-03-12 Thread david
try because undef is evaluated once and then returned again to print * we got 1 warning because undef is returned from eval * we got no warnings for the last try because the string undef is returned from eval * eval{'#'} returns # not undef so your example above will not return undef * eval EXPR vs. eval BLOCK can be found at perldoc -f eval david -- s$s*$+/http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: error during installing Crypt::Idea 1.02

2004-03-16 Thread david
ot suppose to need to compile anything. are you sure you have followed the correct installation procedure for the module? generally speaking, you need: perl Makefile.PL make make test make install make does the actual compilation and linking, make test simply runs the testing script against blib/*

Re: Playing with Unicode

2004-03-25 Thread david
cussion about what Perl should do when it encounters a byte sequence which is different than the current C local. should it upgrade to UTF-8 silently? should it warn? if the current C local is not UTF-8 then what? you can check the p5p list for the discussion. david -- s$s*$+/http://learn.perl.org/> <http://learn.perl.org/first-response>

RE: using strict

2004-04-02 Thread david
Guay Jean-SÃbastien wrote: > >> open (CRITICALSERVERS, "$crout") || die "can't open file \n: $!"; > > As I said, you should replace || by or in the above line. See the > precedence rules in "perldoc perlop" for details. > why do you

RE: using strict

2004-04-02 Thread david
#x27; Died at -e line 1. [panda]# instead of: [panda]# perl -e 'open A,f || die' [panda]# > > Hope this explains this suggestion that might seem, at first, to come out > of the blue! > it does. my main concern is not to confuse beginners who might think a certain construct should never be used. in this example, you sound like 'or' should always be used instead of '||' when checking whether an open success or not. david -- s$s*$+/http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: New to Perl

2004-04-02 Thread david
Wc -Sx- Jones wrote: > Oliver Schnarchendorf wrote: >> By false I mean it isn't set to 1 which equals true. > > > These are false (or undefined) - > > 0 > "0" > "" > NULL > what do you mean by NULL? david -- s$s*$+/http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: New to Perl

2004-04-02 Thread david
Wc -Sx- Jones wrote: > david wrote: > >>>NULL > >> what do you mean by NULL? >> >> david > > explicit zero (0) or nothing ( or undefined.) > > That is NOT true (it's not false either per se...) > you sound more confuse than your p

RE: New to Perl

2004-04-05 Thread david
Charles K. Clarkson wrote: > david <[EMAIL PROTECTED]> wrote: > : > : this is impossible in Perl. show me an example > : where something is neither true nor false. > > Er, um, well ... > > #!/usr/bin/perl > > package foo; > > use strict; &g

RE: using strict

2004-04-05 Thread david
Guay Jean-SÃbastien wrote: > I am sorry David, it just seems like I am having trouble communicating > clearly. We are apparently in a disagreement, but your points are not at > all what I wanted to explain... I'll try again. i totally understand what you are saying and like i sai

Re: New to Perl

2004-04-06 Thread david
Wc -Sx- Jones wrote: > david wrote: > >> how does simply putting a piece of logic in your code and print out an >> error meesage when a variable match a certain value prove something in >> Perl is either true nor false? this is simply impossible in Perl because >&

Re: New to Perl

2004-04-06 Thread david
Wc -Sx- Jones wrote: > david wrote: > >> * You *might* be saying $i is unknown (or undef) because $ENV{something} >> can be true, or false or neither true nor false which '?:' can't handle. >> correct? > > Undef is a valid condition in Perl Yes or

Re: New to Perl

2004-04-06 Thread david
da]# * any valid Perl expression can only be evaluated to 2 possible values when used as a boolean expression: true or false. david -- s$s*$+/http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: determining size of array through reference

2004-04-06 Thread david
correct way to do > this? you can try @{EXP} or $#{EXP}+1 where EXP is your array reference: [panda]# perl -le 'print $#{[1,3,5,7]}+1' 4 [panda]# perl -le 'print @{[1,3,5,7]}+0' 4 [panda]# the '{}' is sometimes optional depends on EXP, i usually use it for

Re: alias a function

2004-04-08 Thread david
different and caller return different trace for this purpose so you might want to consider 'goto &foo' instead. if none of those matters to you, i would just use the first method. david -- s$s*$+/http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: alias a function

2004-04-08 Thread david
Jupiterhost.Net wrote: > > > david wrote: > >> Jupiterhost.Net wrote: >> >> >>>Hello list, >>> >>>I was looking into the best way (and for what reasons) you'd create an >>>"alais" function. >>> >

Re: cleaning up references properly

2004-04-13 Thread david
ll ref() as a GLOB correct (or IO)? it will be a GLOB is it's GLOB and it will be an IO if it's an IO, depends on how you set up your ref: print ref \*STDIN,"\n";#-- GLOB print ref *STDIN{IO},"\n"; #-- IO::Handle be sure to write code that handles both >

Re: problem about compiler

2004-04-13 Thread david
printed to stdout: > Undefined subroutine &main:: called at hello.pl line 4. > that's odd... > What's wrong with it? > Give me a hand please. what version of Perl are you using? david -- s$s*$+/http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: cleaning up references properly

2004-04-13 Thread david
is still defined. finally, notice your undef $$_ is also bugous: [panda]# perl -e '$_ = \\1; undef ${$_}' Modification of a read-only value attempted at -e line 1. [panda]# you don't want that do you? :-) at the end, it's your call and it depends on how you set up your ref and what you want to do with it. david -- s$s*$+/http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: cleaning up references properly

2004-04-13 Thread david
n-home grown modules, similar to checking for > Thread safety or concurrency issues. > right but has OP asked help on those topics? > > It would seem it is still safer to have Perl handle the garbage > collection by mangling the reference counts, possibly through contrived > scoping. Regardless, the code better be *thoroughly* tested... > right. david -- s$s*$+/http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: problem about compiler

2004-04-14 Thread david
unsigned >> > >> > and I ran the binary: >> > $ hello >> > >> > the following infor were printed to stdout: >> > Undefined subroutine &main:: called at hello.pl line 4. where is line 4? i can reproduce your error message with the following s

Re: \b in regexp..

2004-04-14 Thread david
x27;boundary' assertion does not match in end of word , but only the > start of word? > that's because you ask to match the boundary at the start of your word. try: #!/usr/bin/perl -w use strict; $_ = 'as great as perl'; print $&,"\n" if(/eat\b/); print

Re: "\s" eq "\b" ?

2004-04-14 Thread david
#x27;\b success',"\n" if(/great\b/); print '\s success',"\n" if(/great\s/); __END__ prints: \b success david -- s$s*$+/http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: Missing header files???

2004-04-14 Thread david
sco3.2v5.0/CORE/perl.h:414: locale.h: No such > file or directory it's highly unlikely that your machine do not have those headers. do you know where they are located? david -- s$s*$+/http://learn.perl.org/> <http://learn.perl.org/first-response>

RE: Missing header files???

2004-04-14 Thread david
pile anything at all: #include #include main(){;} would adding -I or exporting your env. var C_INCLUDE_PATH help? which is really uneccessary given what you mentioned... david -- s$s*$+/http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: Can't locate object method error

2004-04-24 Thread david
d to 'can't find in @INC' as expected. > why do you change its name especially after you verified that the module does exist? > > I tried a use statement as suggested in the error message, and got the > same error. > is that after you change its name? try not to change its n

Re: What does this command do: "|-"

2004-04-24 Thread david
e unless defined $id; if($id){ select(FILE); $| = 1; while(<>){ last if /quit/i; print FILE; } }else{ while(<>){ chomp; print length,"\n"; } } __END__ [panda]

Re: Multi library

2004-05-13 Thread david
gt;openconf("cfg2.conf"); >> > >> > print $cfg1->param("someparam"); >> > print $cfg2->param("someparam"); >> > >> > it prints two times the param from second conf file. Any ideas or I >> > wasn't clea

Re: How to create a variable dynamically?

2004-04-29 Thread david
;;' ); > } > you need to tell Perl that $x is in package z #!/usr/bin/perl -w package z; use strict 'vars'; sub use_x{ print ${"z::$_[0]"},"\n";} sub def_x{ ${"z::$_[0]"} = $_[1]; } def_x("dog","good"); use_x("dog"); def_x("cat","bad!"); use_x("cat"); __END__ prints: good bad! david -- s$s*$+/http://learn.perl.org/> <http://learn.perl.org/first-response>

text between tag manipulation (HTML)

2011-04-30 Thread David
Hi. I'm trying to insert on-screen sequential numbers (in locally saved web documents) to let non-web designers comment on the elements/tags. Additionally, these numbers act as a pseudo-line/reference number. Just to be clear, if I have: Lorem ipsum dolor Proin sed sapien I'm trying to gen

Re: text between tag manipulation (HTML)

2011-05-01 Thread David
HTML? Sorry, that wasn't worded clearly. I'm trying to manipulate the source code, but I don't want to destroy the tags or the structure of the document. -David -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

getting a url with perl, the url_get library?

2002-06-03 Thread david
There used to be a url_get library, is there something else now? i couldn't find anything on CPAN, this is a http protocol issue right? I just want to have a user enter a url on a form page, then crawl that url for the specified text string. Thank you -- To unsubscribe, e-mail: [EMAIL PROTECT

Re: Date in perl

2005-08-27 Thread David
Well, first, take out the first 4 characters - that's the year. The next 2 characters are the month - make an array, 1 is January, 12 is December - then use that to convert to a month string. Then the last two characters are the day. On Sat, 2005-08-27 at 08:12 -0500, Gomez, Juan wrote: > Hi all

Re: system ("cd ..")

2005-08-30 Thread David
I'm not sure, but putting a ; between the commands might work: system "cd ..; pwd" On Mon, 2005-08-29 at 18:06 +0300, Eliyah Kilada wrote: > Hi, > - I agree with u that a shell script is more appropriate, but how I can > write regular expressions in this way ? ;-) > > Regards, > Eliyah > > >

Re: Exponential numbers

2003-10-09 Thread david
","$_ becomes ",$_); } __END__ prints: 0.203E-2 becomes 0.00203 0.203E+9 becomes 20300 0.203e-9 becomes 0.0203 0.20233E-12 becomes 0.20233 0.123e+3 becomes 123 3435E+15 becomes 3435000 perldoc -f sprintf perldoc -f pri

Re: Exponential numbers

2003-10-09 Thread david
John W. Krahn wrote: > David wrote: >> >> brain dead approach: >> >> #!/usr/bin/perl -w >> use strict; >> >> for(qw~ 0.203E-20.203E+9 0.203e-9 >> 0.20233E-12 0.123e+3 3435E+15 ~){ >> >> /(\d+)E(.)(\d+)/

Re: grep argument list too long...how to get around it?

2003-10-10 Thread david
G_MAX 131072/* # bytes of args + environ for exec() */ [panda]$ > > Is it the same on other *nix systems? > no. it's not always the same for all *nix system. openBSD: [tiger]# grep ARG_MAX /usr/include/sys/syslimits.h #define ARG_MAX (256 * 1024) /* max bytes for an exec

Re: Help w/Class::Date Date.xs

2003-10-14 Thread david
ou trying to do??? did you download a module from CPAN and then trying to install it? what do you mean by where to put the files? david -- $_=q,015001450154015401570040016701570162015401440041,,*,=*|=*_,split+local$"; map{~$_&1&&{$,<<=1,[EMAIL PROTECTED]||3])=>~}}0..s~.~~g

Re: Help w/Class::Date Date.xs

2003-10-14 Thread david
.pm"}' [panda]$ large number of CPAN modules (Class::Date happen to be one of those) are packed/distributed by creating make file with MakeMaker which can be installed by the above procedures. perldoc -q install david -- $_=q,015001450154015401570040016701570162015401440041,,*,=*|=*_,sp

Re: Help w/Class::Date Date.xs

2003-10-15 Thread david
ructured/organized. > > I just have a follow-up question. Is this the best date module or are > there more popular one? > i don't know what your needs are so i don't know what will be the best date/time module for you. my personal favorite date/time

Re: 'rmm' (or 'trash') script

2003-10-24 Thread david
7;) || $!{EEXIST});' [panda]$ 5. see if Getopt::Std (and friends) can help you simplify your arg parsing code. 6. see if Fild::Find can help you simplify some of your dir scanning code. 7. it will be nice to set a limit on how big your trash dir can be. otherwise, it's easy

Re: How do I tell if a module exists?

2003-11-05 Thread david
l perl 0 Can't locate perl.pm in @INC ... etc david -- $_=q,015001450154015401570040016701570162015401440041,,*,=*|=*_,split+local$"; map{~$_&1&&{$,<<=1,[EMAIL PROTECTED]||3])=>~}}0..s~.~~g-1;*_=*#, goto=>print+eval -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: How do I glob with escaped spaces in a directory

2003-11-06 Thread david
[panda]# perl -MFile::Glob=:glob -le 'print bsd_glob("foo .txt",GLOB_QUOTE)' foo .txt [panda]# rm -f "foo .txt" [panda]# perl -MFile::Glob=:glob -le 'print bsd_glob("foo .txt",GLOB_QUOTE)' [panda]# perldoc File::Glob david -- $_=q,0150014501540154

Re: Peculiar problem using LWP::UserAgent

2003-11-10 Thread david
>is_success); print $r->code,': ',$r->status_line unless($r->is_success); print "\n"; } print_page('http://google.com');#-- works fine print_page('http://google.com',80); #-- works fine print_page('google.com'); #--

Re: print values out of a hash

2003-11-11 Thread david
cerned, there is nothing wrong with this piece of code. if you only see one value, you either have one key in your %hash or all your keys in the hash contain exectly the same value, $array[3] in this case. the problem most likely originated in other part of your script. for example, how do you store

Re: Counting (easy!)

2003-11-12 Thread david
e in > general? For example, what's the thought process for trying to do what I > want to do? I've tried pseudo code and it's helped some but then I hit the > wall and don't how to go further. Thanks! like count down from 5 to 1 slowly in

Re: How do you dynamically assign array names?

2003-11-14 Thread david
Douglas Houston wrote: > Hi, > > I am trying to initialize a dynamically-named array, i.e. with the > following test code (if I type "script.pl char" at the command prompt) I > get the message "array char contains 1 2 3" but I get a warning if 'use > strict' is on. Can anyone show me how it shoul

Re: How do you dynamically assign array names?

2003-11-14 Thread david
David wrote: >> this normally can't be done cleanly and is generally not recommanded >> given there are other ways to accomplish bascially the same thing. Steve Grazzini wrote: > > But why use the symbol table at all? That's more dangerous than using > a regu

RE: Portable unix du command

2003-11-18 Thread david
("/home/joemama"); try Filesys::DiskFree #!/usr/bin/perl -w use strict; use Filesys::DiskFree; my $h = Filesys::DiskFree->new; $h->df; $h->device('/usr'); print "/usr has ",$h->avail('/usr')," bytes available\n"; __END__ prints:

Re: Strange characters

2003-11-19 Thread david
lly do not have to worry about this. some distribution of linux, especially those from RH, might need to. david -- s,.*,<<,e,y,\n,,d,y,.s,10,,s .ss.s.s...s.sss.s.ss s.s.s...s...s..s ...s.ss..s.sss..ss.sss.s s.s.s...ss.sss.s ..s..sss.s.ss.sss... .

Re: Pattern Matching

2003-11-19 Thread david
Rob wrote: > This is what I finally came up with, but it too seems rather clunky. > > my $cnt = 0; > $_ = $notes; > $cnt = tr/\n//; > clunky? what's your definition of not clunky? shorter one: my $count = $notes =~ y/\n//; david -- s,.*,<<,e,y,\n,,d,y,.s,10,,s

Re: TokeParser help

2003-11-19 Thread david
print $text,"\n"; $text = ''; } if($token->[0] eq 'T'){ $text .= $token->[1]; } } __DATA__ Head 1 Bolded Bolded and underlined New line __END__ prints: Bolded Bolded and underlin

RE: Strange characters

2003-11-20 Thread david
ou do: env | grep LANG i have never used Cygwin. what shell are you using? some shell use a different syntax for setting env variable. david -- s,.*,<<,e,y,\n,,d,y,.s,10,,s .ss.s.s...s.sss.s.ss s.s.s...s...s..s ...s.ss..s.sss..ss.sss.s s.s.s...ss.sss.s ..s.

Re: How to work with 64 Bit unsinged Intergers or "Network" formatted numbers.

2003-11-20 Thread david
s means that the value 36893488147419103231 becomes 8589934591. no it isn't. Math::BigInt has no problem doing that: [panda]# perl -MMath::BigInt -le ' print Math::BigInt->new("36893488147419103231")->badd(1)' 36893488147419103232 as you can see it's not choppe

Re: How does perl compile functions

2003-11-20 Thread david
i am guessing that you are thinking about something along the line of Autoload or compile vs. runtime stuff like: [panda]# perl -ce 'print _not_a_real_function()' -e syntax OK [panda]# perl -e 'print _not_a_real_function()' Undefined subroutine &main::_not_a_real_function

FW: RE: Strange characters

2003-11-20 Thread david
David O'Connor wrote: > > stop using cygwin. i find it rather problematic and funny > (especialy if you> size the window.) if you do not have ready access to a > linux box, download, burn, and run knoppix. i have never had a problem on > knoppix > > davidO > >

Re: using perl interpreter interactively like python?

2003-11-20 Thread david
nda]# 'q' will exit the debugger. lines ends with '\' signal the debugger to grab the next line. it's a little unusually to use the debugger for an interactive Perl session but it's capable of doing it. perldoc perldebug david -- s,.*,<<,e,y,\n,,d,y,

Re: search and replace in complexed text file?

2003-11-21 Thread david
for example, if each record is separated by '--' on its own, you might be able to set $/ to '--' and just read each record as they come along. Or if all records have the same number of rows, you can read a fixed number of lines for each record and do something with them.

Re: Can I improve the performance of script by using constant?

2003-11-24 Thread david
you statment: my $const = 1e-21; is not a const at all. it's just a scalar. david -- s,.*,<<,e,y,\n,,d,y,.s,10,,s .ss.s.s...s.sss.s.ss s.s.s...s...s..s ...s.ss..s.sss..ss.sss.s s.s.s...ss.sss.s ..s..sss.s.ss.sss... ..ssss.sss.s..

Re: Sys:Syslog

2003-11-24 Thread david
alls, everthing > works. what machine are you running this with? how do you verify that nothing is printed? i have no problem doing the following: #!/usr/bin/perl -w use strict; use Sys::Syslog; openlog($0 => pid => 'user'); syslog('err','test erro

Re: using perl in a c code

2003-12-01 Thread david
ail %d is: %s\n",x+1,SvPV(email,y)); } perl_destruct(perl); perl_free(perl); } to compile this C program, you will need to know how Perl is build in your machine, the following usually does the trick: [panda]# gcc test.c -o test `perl -MExtUtils::Embed -e ccopts -e

Re: perl -ne 'if(/rcn/) {print "$ARGV: $_" unless -d}' *

2003-12-02 Thread david
perl -ne 'print unless -B $ARGV' * which is not very efficient because of the stat on every line. a more efficient approach is to isolate the binary files first and then print the rest like: [panda]# perl -pe1 `perl -le '-B or print for @ARGV' *` [panda]# perl -e '-B or

RE: using perl in a c code

2003-12-03 Thread david
gc, argv, (char **)NULL); to: perl_parse(my_perl, xs_init, argc, argv, (char **)NULL); i omit a LOT of details but it's almost impossible to tell you everything you need to know to successfully embed Perl in C with a single message. david -- s,.*,<<,e,y,\n,,d,y,.s,10,,s .ss.s.s...s.sss

RE: using perl in a c code

2003-12-03 Thread david
Dan Muey wrote: [snip] > /* From David >printf("%s",SvPV_nolen(eval_pv(perlcode,0))); > at compile: > cc -o perlemb perlemb.c `perl -MExtUtils::Embed -e ccopts -e ldopts` > /tmp/ccTi5bTD.o: In function `main': > /tmp/ccTi5bTD.o(.text+0x77): undefined referen

RE: using perl in a c code

2003-12-03 Thread david
ly be solve by adding: char* nothing[] = {"","-e1"}; along the top of the program and then change: >>perl_parse(my_perl, NULL, argc, argv, (char **)NULL); to: perl_parse(my_perl, NULL, 2, nothing, (char **)NULL); david -- s,.*,<<,e,y,\n,,d,y,.s,10,,s .ss.s.s..

RE: 64 bit Perl memory test...

2003-12-04 Thread david
l -e '$#a+=0x while 1' [panda]# perl -e '$i.=0x0x while 1' david -- s,.*,<<,e,y,\n,,d,y,.s,10,,s .ss.s.s...s.sss.s.ss s.s.s...s...s..s ...s.ss..s.sss..ss.sss.s s.s.s...ss.sss.s ..s..sss.s.ss.sss... ..ssss.sss.s

RE: 64 bit Perl memory test...

2003-12-04 Thread david
g memory allocation for your machine. david -- s,.*,<<,e,y,\n,,d,y,.s,10,,s .ss.s.s...s.sss.s.ss s.s.s...s...s..s ...s.ss..s.sss..ss.sss.s s.s.s...ss.sss.s ..s..sss.s.ss.sss... ..ssss.sss.sss.s ,{4},"|?{*=}_'y!'+0!

Re: 64 bit Perl memory test...

2003-12-05 Thread david
t top/ps whether than what the script output but again, you should research a bit and see if there are tools designed specially for this purpose. the toy-script approach can only get you this far. david -- s,.*,<<,e,y,\n,,d,y,.s,10,,s .ss.s.s...s.sss.s.ss s.s.s...s...s..s.

Re: Frustrated newbie question

2003-12-05 Thread david
use m// like: my @names = /\S+/g; which search for one or more none space characters that are stick together and put each of them into @names. or you can use s/// like: s/\s+/\n/g; print "$_\n"; which search for one or more continueous spaces and translate them into a newline.

Re: Can't find package AutoLoader in CGI::Application program

2003-12-08 Thread david
$|++; your GroupRank.pm module doesn't seem to return a true value. change '$|++;' to '$|=1;' and see what happen. david -- s,.*,<<,e,y,\n,,d,y,.s,10,,s .ss.s.s...s.sss.s.ss s.s.s...s...s..s ...s.ss..s.sss..ss.sss.s s.s.s...ss.s

Re: pid of process opened by system

2003-12-08 Thread david
}elsif($error =~ /fork/){ die "Unable to fork: $error"; }else{ die "Error: $error"; } } __END__ [panda]# demo.pl 2 [panda]# demo.pl 20 sleep taking too long: alarm at ./tmp.pl line 10. [panda]# david -- s,.*,<<,e,y,\n,,d,y

Re: The True Path to Learning Perl Re: [OT] Education Level

2003-12-09 Thread david
Drieux wrote: > In PART because with things like the Internet, IF > one wants to learn, one can and at far cheaper rates. if this is a joke, it's laughable. if it's not a joke, you are laughable. david -- s,.*,<<,e,y,\n,,d,y,.s,10,,s .ss.s.s...s.sss.s.ss s.

Re: pid of process opened by system

2003-12-09 Thread david
[EMAIL PROTECTED] wrote: > This doesn't work, because system forks itself: > > Parent > `- child1 (opened by fork) > `- child2 (opend by system of child1) > yes and sorry i misunderstood your question. david -- s,.*,<<,e,y,\n,,d,y,.s,10,,s .ss.s.s...s.s

Re: Problems forking -- fork DOSes my comp

2003-12-10 Thread david
for(1..50){ my $pid = fork; die "no resource" unless(defined $pid); next if($pid); open(CHILd,">$_") || die $!; print CHILD $$,"\n"; close(CHILD); exit; #-- kill child so it does go back } __END__ david -- s,.*,&

Re: simple link checker...

2003-12-10 Thread david
s: GOOD: http://www.hotmail.com GOOD: http://www.perldoc.com 500 Can't connect to www.not-found99.com:80 (Bad hostname 'www.not-found99.com') http://www.not-found99.com i believe the HTML::LinkExtor has a better and more complete example so you should check it out: perldoc HTML::Li

Re: Search and Replace question

2003-12-11 Thread david
2 = $line1; #-- #-- for your purpose, you can use either one of followings #-- $line1 =~ s/ABCXYZ(.+?)TI/Hello$1/g; $line2 =~ s/ABCXYZ(.*?)TI/Hello$1/g; print $line1,"\n"; print $line2,"\n"; __END__ prints: HelloGwc\HelloIntVal HelloGwc\HelloIntVal david -- s,.*,<<

Re: nested Paren's

2003-12-11 Thread david
Eric Walker wrote: > Hey all, > I have a file with some data that has like nested parens.. example > > yes( "hello" "goodbye" > > ( (one 2) (two 3) (three 4) > ) > (( mon 1) (tues 2) (wed 3) > ) > ((jan 1) (feb 2) (march 3) > ) > ) > > I need help in trying to bre

RE: Use DBI quote without creating an object

2003-12-11 Thread david
Bob Showalter wrote: >use DBI; >print DBD::_::db->quote('Hello'); > > perldoc -m DBI this does not work, you need: [panda]# perl -MDBI -le 'print DBD::_::db::quote(1,"abcd")' david -- s,.*,<<,e,y,\n,,d,y,.s,10,,s .ss.s.s...s.s.

RE: Use DBI quote without creating an object

2003-12-11 Thread david
David wrote: > Bob Showalter wrote: > >>use DBI; >>print DBD::_::db->quote('Hello'); >> >> perldoc -m DBI > > this does not work, you need: > sorry. i am wrong. your version works as well. david -- s,.*,<<,e,y,\n,,d,y,.s,1

Re: could use an audit

2003-12-12 Thread david
nts: * Leo RX 2.87 MB TX 7.18 MB * Buffy2 RX 9.61 MB TX 0.14 MB i think the only line that deserve any explanation is: print . ; which simply forecs to be in scalar context so it return the next 2 lines which we know will be the stat of the server. david -- s,.*,<<,e,

Re: Internal -e escape char

2003-12-16 Thread david
ough the textarea, when the submit button is clicked, a tmp file is create which holds the code from the textarea. the file is then run from the command line and output is returned back to the textarea. finally, the tmp file is deleted when the script finish. david -- sub'_{print"@_

Re: Can I set '$!' ?

2003-12-16 Thread david
7 /* File exists */ ... you can then assign $! like: [panda]# perl -MErrno=:POSIX -le '$!=ENOTDIR; print $!+0,": ",$!' 20: Not a directory mess with errno only when you really need to! david -- sub'_{print"@_ ";* \ = * __ ,\ & \} sub'__{print"

  1   2   3   4   5   6   7   8   9   10   >