how to get the env of one PID .
my $file="/proc/1/environ"; system "xxd $file"; open FILE,"< $file" or die "open $file err:$!"; my $c=<FILE>; close FILE; my $hex=unpack "H*",$c; print "\n$hex\n\n"; my @list=split /00/,$hex; foreach (@list) { print pack ("H*",$_) . "\n"; } > -----邮件原件----- > 发件人: Shlomi Fish [mailto:shlo...@iglu.org.il] > 发送时间: 2009年11月19日 23:24 > 收件人: beginners@perl.org > 抄送: gaochong > 主题: Re: the question of one program > > On Thursday 19 Nov 2009 16:54:00 gaochong wrote: > > Now I have see the following page ,but I have some question and need help . > > > > http://www.cpan.org/authors/id/S/SU/SUJAI/Process-Detail-0.1.pl > > > > From a quick look, this script seems awful: > > 1. No "use strict;" and "use warnings;". > > 2. uses "Switch.pm". > > 3. Uses bareword file-handles. > > 4. No three-args open. > > I would suggest to avoid using it because it's not modern perl. > > > > > > > first,what is the meaning of if($pcs =~ /(\d+)/ && $pcs =~ /\./) ,I can’t > > understand the re /\./ > > > > "." matches any character (except possibly newline, etc., but sometimes also > that if you use m{...}s). "\." inside a regex matches an actual "." (period, > dot, full stop etc. - http://en.wikipedia.org/wiki/Full_stop ) > > > > > > > > sub hidden > > > > { > > > > print "\n##########Hidden processlist###############\n\n"; > > > > foreach $pcs (readdir(DIR)) > > > > { > > > > if($pcs =~ /(\d+)/ && $pcs =~ /\./) > > > > { > > > > &detailedview("$pcs"); > > > > } > > > > } > > > > } > > > > > > > > the second , @array=split(/([A-Z]+(_|[A-Z])+\=.[^A-Z]+)/,$_); > > also the re \=.[^A-Z]+ what’s it ? > > \= is an actual "=". A "=" would be fine here, too. "." is any character > except a newline. "[^A-Z]" is any character except the uppercase Latin ASCII > letters ("A", "B", "C"..."Z"). "+" is "one or more" when applied to the > suffix. You can see signs of "ancient perl" in this expression, because it > uses several capturing parentheses ("(...)") instead of clustering ones > ("(?:...)"). > > http://www.shlomifish.org/lecture/Perl/Newbies/lecture2/regexps/next_step. > html > > > > > > > > > > > > open(FILE,"<$envir"); > > This should better be: > > <<< > open my $file, "<", $envir > or die "....$!"; > > >>> > > This script is horrible. Avoid it. > > Regards, > > Shlomi Fish > > > while(<FILE>) > > { > > @array=split(/([A-Z]+(_|[A-Z])+\=.[^A-Z]+)/,$_); > > > > thanks > > > > -- > ----------------------------------------------------------------- > Shlomi Fish http://www.shlomifish.org/ > http://www.shlomifish.org/humour/ways_to_do_it.html > > Chuck Norris read the entire English Wikipedia in 24 hours. Twice. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/