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
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 -
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
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/
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/
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/
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/
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
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*
;
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>
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>
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
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>
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>
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>
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>
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>
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
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>
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>
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/*
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>
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
#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>
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>
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
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
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
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
>&
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
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>
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
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>
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.
>>>
>
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
>
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>
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>
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>
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
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
#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>
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>
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>
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
e unless defined $id;
if($id){
select(FILE); $| = 1;
while(<>){
last if /quit/i;
print FILE;
}
}else{
while(<>){
chomp;
print length,"\n";
}
}
__END__
[panda]
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
;;' );
> }
>
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>
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
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/
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
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
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
>
>
>
","$_ 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
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+)/
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
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
.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
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
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
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]
[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
>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'); #--
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
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
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
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
("/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:
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...
.
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
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
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.
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
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
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
>
>
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,
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.
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..
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
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
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
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
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
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..
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
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!
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.
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.
$|++;
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
}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
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.
[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
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,.*,&
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
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,.*,<<
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
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.
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
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,
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"@_
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 - 100 of 2660 matches
Mail list logo