Re: website
On Thu, May 15, 2008 at 3:45 PM, Dr.Ruud <[EMAIL PROTECTED]> wrote: > It contains a lot of bad advice too. You have been helpful in the past so please be so kind to point out the *bad Advice*... Just saying it's bad really helps no one on a "beginners" list. The way I see it, people will read that information, begin to code with it, then when they run into problems they come here only to be chastised by using such examples. Why not end that loop by good examples? - Horray, Horray! I agree with all stated here. I have been doing Perl for seven years now and still consider myself a beginner at many concepts. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
passing args to sub wanted
Greetings, I posted this question on perlmonks and received some great help, specifically from mirod but his recent suggestion is still not working. Problem: This code only works when I hard-code the size to search for in the routine. I try to pass arguments using @_, but it does not work. How do I pass $size_input so wanted sees and uses it? Mirod's help: You need to pass an additional parameter to wanted. The way to do this is to use a closure: File::Find::find({wanted => sub { wanted( $size_input); } }, $fs_input ) ;. This way wanted is called by the anonymous sub, and gets passed $size_input. See Why I hate File::Find and how I (hope I) fixed it for more info. I read the "why i hate" two and three times and yet still cannot get it to work. thank you in advance! http://www.perlmonks.org/?node_id=687008 use strict; use warnings; use File::Find; my ( @root_files, @large_files, %mounts, @mounts, ) ; use vars qw/*name *dir *prune/ ; *name = *File::Find::name ; *dir= *File::Find::dir ; *prune = *File::Find::prune ; } else { print "USING LAST ELSE\n"; my $size_input = ( int 25 * ( 1024**2 ) ) ; $size_input =~ tr /\000//d ; my $wanted = make_wanted ( \&wanted_1, $size_input ) ; File::Find::find( $wanted, $fs_input ) ; print "\n"; } sub wanted_1 { for my $key ( sort keys %mounts ) { if ( $fs_input eq $key ) { @mounts = grep {$fs_input} @{ $mounts{$key} } ; ###-- HoA --### } } if ( scalar @mounts > 0 ) { die "cant search...foobarbay $!" ; } else { my ( $size_input ) = shift @_ ; print $size_input,"\n"; my ($dev,$ino,$mode,$nlink,$uid,$gid) ; (( $dev,$ino,$mode,$nlink,$uid,$gid ) = lstat($_) ) && ( $dev >= 0 ) && !( $File::Find::prune |= ($dev != $File::Find::topdev ) ) && ( int(((-s _) + 1023) / 1024 ) > $size_input ) && push ((@large_files), $name ) ; } } sub make_wanted { my $wanted = shift ;# get the "real" wanted function my @args = @_;# "freeze" the arguments my $sub = sub { $wanted->( @args ); } ; # generate the anon sub return $sub ; # return it } print "\n",scalar @large_files,"\n"; exit; $size_input is being printed correctly/accurately, but nothing in the array. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
sysread, sysseek, sysopen
Are any of these calls deprecated or not recommended? If so, what is recommended regardless of context. sysopen INFILE, \"/dev/vpathXXX\", 0; \$i=0; sysseek(INFILE, 0, 0); while(sysread INFILE, \$buf, 1) {sysseek(INFILE,268435456,1); thank you! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: bash in perl
- Original Message From: pouliakhina To: beginners@perl.org Sent: Saturday, February 7, 2009 8:59:56 AM Subject: bash in perl Hello, I try to write the name of the current directory in $x: $x = system ("pwd"); But it doesn't work. It also doesn't work in all these combinations: $x = 'system("pwd")'; $x = system("`pwd`"); Can You help me to write the result of 'pwd' in $x? Thank You, Irina ## Ur Welcome! $ perl -le '$x = system("pwd"); print $x;' /home/Smith 0 sm...@smith-laptop ~ $ perl -le '$x = qx(pwd); print $x;' /home/Smith -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Turn off $ anchor greedy behavior
Perl sucks...go Ruby...I did and I am much happier! - Original Message From: Michael Alipio To: Perl Beginners ; John W. Krahn Sent: Tuesday, April 14, 2009 10:06:39 AM Subject: Re: Turn off $ anchor greedy behavior Aha, found it.. The split returned a list and you've just sliced it. giving [-1] means the list will start running through the elements backwards. --- On Tue, 4/14/09, Michael Alipio wrote: > From: Michael Alipio > Subject: Re: Turn off $ anchor greedy behavior > To: "Perl Beginners" , "John W. Krahn" > Date: Tuesday, April 14, 2009, 10:02 PM > > > > Or use split and return the last field: > > > > $ perl -le' > > my $string = "boy, pig, 123, 123:412adbd, d0g, > > lajdlf134><<_ lkadsf !234,\n"; > > my $value = ( split /,\s+/, $string )[ -1 ]; > > Another mind bogling example... :-) > I thought I would do: > > my @value = ( split /,\s+/, $string ); > print $value[6]; > > How could your example, have printed the last field using [ > -1 ]? > Can I also print say, the 3rd field using this trick? > > > > > > > > print $value; > > ' > > lajdlf134><<_ lkadsf !234 > > > > > > > > > > > > John > > -- Those people who think they know everything are a > great > > annoyance to those of us who do.-- Isaac > Asimov > > > > -- To unsubscribe, e-mail: > beginners-unsubscr...@perl.org > > For additional commands, e-mail: > beginners-h...@perl.org > > http://learn.perl.org/ > > > > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org/ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
regexp
I have this block of text: Node: dudbqa02 Message group: MoM_OpC_ADM-m-s Application: OGTP Object:syslog Severity: Critical Text: WebSph ere Broker v6003[2998366]: (QWMB01.EG500)[8225]BIP2951I: Event generated by user code. Additional information : 'msgagt=ESM_WMB_AIX,sec_id=Sec _id,severity=Low,msgnode=qwmbap01.cardinalhealth.net,utc={2007-04-26 18:01:59.472+00:00},om={UID=3a7affd6-f420-11db-80b1-,AlertCod e=AEM001,AlertType=AEM-default,AppName=AEM-CommonService2,Message=5004:An error has been reported by the BIPXML4C component.:XML}' 'MS_Alert_E SM_Integrator.InsertToSYSLOG' '{2}' '{3}' '{4}' '{5}' '{6}' '{7}' '{8}' '{9}' : QWMB01.1aef50ec-1001--0080-dae5df22a0ad: /build/S600_P/src /DataFlowEngine/ImbRdl/ImbRdlThrowExceptionStatements.cpp: 158: SqlThrowExceptionStatement::execute: ComIbmComputeNode: MS_Alert_ESM_Integrato r#FCMComposite_1_2,cma={Location=Not_found,BusUnit=Not_found} The strings I need out of this are: msgagt=ESM_WMB_AIX sec_id=Sec_id severity=Low msgnode=qwmbap01.cardinalhealth.net utc={2007-04-26 18:01:59.472+00:00} om={ UID=3a7affd6-f420-11db-80b1- AlertCode=AEM001 AlertType=AEM-default AppName=AEM-CommonService2 Message=5004:An error has been reported by the BIPXML4C component.:XML } I have this test code but does not work: #!/usr/bin/perl use strict; use warnings; use diagnostics; my $ovo= qq(/home/dbsmith/out); my $msgagt = qr/(\w+\=\w+)/is; open (my $out, "+<", $ovo) or die "file '$ovo' was not opened $!"; while (<$out>) { s/^\s+|\s+$//g; ## rid of newlines at begin and end next unless length $_; ## skip line of length undef print $_ if (/$msgagt/); } Any help/ideas? thank you. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: regexp ...
> > The strings I need out of this are: > > msgagt=ESM_WMB_AIX > > sec_id=Sec_id > > severity=Low > > msgnode=qwmbap01.cardinalhealth.net > > utc={2007-04-26 18:01:59.472+00:00} > > om={ > > UID=3a7affd6-f420-11db-80b1- > > AlertCode=AEM001 > > AlertType=AEM-default > > AppName=AEM-CommonService2 > > Message=5004:An error has been reported by the > BIPXML4C component.:XML > > Now I am trying to break up string into individual chars, but this does not seem to work: while (<$out>) { s/^\s+|\s+$//g; ## rid of newlines at begin and end next unless length $_; ## skip line of length undef push @chars, unpack ("A*" x length($_), $_); } __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: regexp ...
> > Now I am trying to break up string into individual > > chars, but this does not seem to work: > snip > > The idiomatic way is > > for my $chr (split //, $str) { > } ok thanks for this code, but that produces the same output as the unpack. :) The original code (\w+\=\w+,) seems work but is grabbing all the garbage infront: ere Broker v6003[2998366]: (QWMB01.EG500)[8225]BIP2951I: Event generated by user code. Additional information : 'msgagt=ESM_WMB_AIX,sec_id=Sec_id,severity=Low,msgnode=qwmbap01.cardinalhealth.net,utc={2007-04-26 18:01:59.472+00:00},om={UID=3a7affd6-f420-11db-80b1-,AlertCode=AEM001,AlertType=AEM-default,AppName=AEM-CommonService2,Message=5004:An error has been reported by the BIPXML4C [EMAIL PROTECTED] vi parse_4_ovo.plx 2,cma={Location=Not_found,BusUnit=Not_found} Goal is: msgagt=ESM_WMB_AIX sec_id=Sec_id severity=Low msgnode=qwmbap01.cardinalhealth.net utc={2007-04-26 18:01:59.472+00:00} om={ UID=3a7affd6-f420-11db-80b1- AlertCode=AEM001 AlertType=AEM-default AppName=AEM-CommonService2 Message=5004:An error has been reported by the BIPXML4C component.:XML } __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: regexp ...
> > > Now I am trying to break up string into > individual > > > chars, but this does not seem to work: > > snip > > > > The idiomatic way is > > > > for my $chr (split //, $str) { > > } > > Funny I had to explain split /|/, $str returning an > array of characters. > > -- > Ken Foskey > FOSS developer > Excellent Ken, thank you, but why the pipe | and how does this differ from ' ' or \s+. I used Dumper and it showed the array of chars, but want to understand. Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more. http://mobile.yahoo.com/go?refer=1GNXIC -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: regexp ...
> Since you haven't provided the original data, it's a > bit difficult to > give advice. There's nothing here, for instance, to > show what you hope > to gain by splitting the string into characters. It > looks to me like > you have CSV and want to split on the commas: Jay the original data I posted 3 or so emails ago, but here it is, all on one line. :) 'msgagt=ESM_WMB_AIX,sec_id=Sec_id,severity=Low,node=test,msgnode=qwmbap01.cardinalhealth.net,utc={2007-04-26 18:01:59.472+00:00},om={UID=3a7affd6-f420-11db-80b1-,AlertCode=AEM001,AlertType=AEM-default,AppName=AEM-CommonService2,Message=5004:An error has been reported by the BIPXML4C component.:XML}' '[EMAIL PROTECTED] Code is: #!/usr/bin/perl use strict; use warnings; #use diagnostics; use Data::Dumper; my $ovo= qq(/home/dbsmith/out); my (@chars,$char) = (); my $msgagt = qr/(\w+\=\w+\,)/is; open (my $out, "+<", $ovo) or die "file '$ovo' was not opened $!"; while (<$out>) { s/^\s+|\s+$//g; # rid of newlines at begin and end next unless length $_; ## skip line of length undef if (/$msgagt/) { push @chars, $_; } } ## Have not coded last part to grab om{... maybe best solution is a hash while splitting on /=/, but I tried this and did not get it to work. I only need out of this : msgagt=ESM_WMB_AIX sec_id=Sec_id severity=Low msgnode=qwmbap01.cardinalhealth.net utc={2007-04-26 18:01:59.472+00:00} om={ UID=3a7affd6-f420-11db-80b1- AlertCode=AEM001 AlertType=AEM-default AppName=AEM-CommonService2 Message=5004:An error has been reported by the BIPXML4C component.:XML } Got a little couch potato? Check out fun summer activities for kids. http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: regexp ...
'msgagt=ESM_WMB_AIX,sec_id=Sec_id,severity=Low,node=test,msgnode=qwmbap01.cardinalhealth.net,utc={2007-04-26 18:01:59.472+00:00},om={UID=3a7affd6-f420-11db-80b1-,AlertCode=AEM001,AlertType=AEM-default,AppName=AEM-CommonService2,Message=5004:An error has been reported by the BIPXML4C component.:XML}' 'MS_Alert_E Take that back...meant to say all I need it everything between '=' and ',' then everything after utc{ and om{, but these names are not static so \w+\{ may work, but have not tried \w+\{ Get the free Yahoo! toolbar and rest assured with the added security of spyware protection. http://new.toolbar.yahoo.com/toolbar/features/norton/index.php -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: encode UTF8 -> MIME
> Oddly, there's a uri_unescape_utf8 but no > uri_unescape_utf8 provided > by URI::Escape. > > However combining URI::Escape::uri_unescape() and > Encode::decode_utf8() > in one statement is not overly taxing. > > use Encode; > use URI::Escape qw(uri_unescape); > my $e_accute = decode_utf8 uri_unescape '%C3%A9'; > Is %C3 equal to à Capital A, tilde and %A9 equal to © Copyright. ? So you are trying to convert to HTML Flash found here http://www.allwebco-templates.com/support/S_hex.htm? http://dsmith1.userworld.com/html_css/derek.htm Yahoo! oneSearch: Finally, mobile search that gives answers, not web links. http://mobile.yahoo.com/mobileweb/onesearch?refer=1ONXIC -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
flock question
In this code: BEGIN { use Fcntl ':flock'; open( DATA, qq(C\:\\temp\\file.txt) ) or die "file handle was not opened: $!"; for my $foo () { print $foo; } flock DATA, LOCK_EX | LOCK_NB or exit 0; } Is there anything more one could add to this statement from the Cookbook: If you use LOCK_NB and are refused a LOCK_SH, then you know that someone else has a LOCK_EX and is updating the file. If you are refused a LOCK_EX, then someone holds either a LOCK_SH or a LOCK_EX, so you shouldn't try to update the file. thank you Pinpoint customers who are looking for what you sell. http://searchmarketing.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Getting a program pid
> > #!/usr/bin/perl -w > > use strict; > > my $program = "vi"; > my $status = `/bin/ps cat | /bin/grep $program`; > > if ( length($status) > 0 ) { > print "$status"; #extract > pid from here > } > else { print "$program not running\n" }# start > program > > > This will work, in the past I have used http://search.cpan.org/~durist/Proc-ProcessTable-0.41/Process/Process.pm and http://search.cpan.org/~wyant/Win32-Process-Info-1.009/lib/Win32/Process/Info.pm Get the free Yahoo! toolbar and rest assured with the added security of spyware protection. http://new.toolbar.yahoo.com/toolbar/features/norton/index.php -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Simple Encryption - what function/module could I use?
> > #!/usr/bin/perl > > > > use strict; > > use warnings; > > > > my $plaintext = do { local $/ = undef; <> }; > > my $pad = "X" x length $plaintext; > > > > my $encryptedtext = $plaintext ^ $pad; > > my $decryptedtext = $encryptedtext ^ $pad; > > print > "plaintext:\n$plaintext\n\nencryptedtext:\n$encryptedtext\n\n", > > "decryptedtext:\n$decryptedtext\n"; > > > > I like it! I just need a simple way to encypt text > to store in a text > file. To protect sensitive info. > Thanks > I like it to, but dont understand how it is encrypting. Will you kindly expalin? Pinpoint customers who are looking for what you sell. http://searchmarketing.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Simple Encryption - what function/module could I use?
--- oryann9 <[EMAIL PROTECTED]> wrote: > > > > #!/usr/bin/perl > > > > > > use strict; > > > use warnings; > > > > > > my $plaintext = do { local $/ = undef; <> }; > > > my $pad = "X" x length $plaintext; > > > > > > my $encryptedtext = $plaintext ^ $pad; > > > my $decryptedtext = $encryptedtext ^ $pad; > > > print > > > "plaintext:\n$plaintext\n\nencryptedtext:\n$encryptedtext\n\n", > > > "decryptedtext:\n$decryptedtext\n"; > > > > > > > I like it! I just need a simple way to encypt text > > to store in a text > > file. To protect sensitive info. > > Thanks > > Please ignore last message and read this one. So you are using the binary ^ to encrypt with XORED together bit by bit? Please explain? thank you. $/etc/skel $ perl -le 'print "hello" ^ "X";' 0=447 $ perl encrypt.plx file2 plaintext: hello encryptedtext: 0=447R decryptedtext: hello Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Simple Encryption - what function/module could I use?
> > > > > > #!/usr/bin/perl > > > > > > > > use strict; > > > > use warnings; > > > > > > > > my $plaintext = do { local $/ = undef; <> }; > > > > my $pad = "X" x length $plaintext; > > > > > > > > my $encryptedtext = $plaintext ^ $pad; > > > > my $decryptedtext = $encryptedtext ^ $pad; > > > > print > > > > > > "plaintext:\n$plaintext\n\nencryptedtext:\n$encryptedtext\n\n", > > > > "decryptedtext:\n$decryptedtext\n"; > > > > > > > > > > I like it! I just need a simple way to encypt > text > > > to store in a text > > > file. To protect sensitive info. > > > Thanks > > > > > Please ignore last message and read this one. > So you are using the binary ^ to encrypt with XORED > together bit by bit? Please explain? > > thank you. > > > $/etc/skel > $ perl -le 'print "hello" ^ "X";' > 0=447 > > $ perl encrypt.plx file2 > plaintext: > hello > > encryptedtext: > 0=447R > > decryptedtext: > hello Also noticed I could use binary & and | $ perl -le 'print "hello" & "X";' [EMAIL PROTECTED] $ perl -le 'print "hello" | "X";' x}||⌂ but these were not decrypted. Why not? Got a little couch potato? Check out fun summer activities for kids. http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Simple Encryption - what function/module could I use?
So you are using the binary ^ to encrypt with XORED together bit by bit? Please explain? thank you. $/etc/skel $ perl -le 'print "hello" ^ "X";' 0=447 $ perl encrypt.plx file2 plaintext: hello encryptedtext: 0=447R decryptedtext: hello Also noticed I could use binary & and | $ perl -le 'print "hello" & "X";' [EMAIL PROTECTED] $ perl -le 'print "hello" | "X";' x}||⌂ but these were not decrypted. Why not? ___ You snooze, you lose. Get messages ASAP with AutoCheck in the all-new Yahoo! Mail Beta. http://advision.webevents.yahoo.com/mailbeta/newmail_html.html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Simple Encryption - what function/module could I use?
ok must of missed it. sorry. Got a little couch potato? Check out fun summer activities for kids. http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Uninstalling a PERL module
--- a_arya2000 <[EMAIL PROTECTED]> wrote: > Hello, does anyone know what is the most effective > way > of uninstalling perl module? Thank you. > Why would you want to do such a thing? Just take the path to this module out of @INC by editing your .profile and or PERL5LIB variable, unless you think its corrupt. perl -le 'print join("\n", @INC);' If you really want to remove this module do a backup first, tar cvf module.tar /path/to/module, then rm -rf /path/to/module Here is a script to see what is installed. ##-- Show me all installed Modules --## use File::Find 'find'; use File::Spec::Functions; my $i=0; print "Your installed modules on $^O are:\n"; print "-" x 38,"\n"; find { wanted => sub { print ++$i, "\t$_\n" if /\.pm\z/ }, no_chdir => 1}, @INC; Hope that helps! :) Be a better Globetrotter. Get better travel answers from someone who knows. Yahoo! Answers - Check it out. http://answers.yahoo.com/dir/?link=list&sid=396545469 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: [PERL] Net::SFTP functions
--- Octavian Rasnita <[EMAIL PROTECTED]> wrote: > Hi, > > You need to use: > > $ftp->get("/path/to/remote/file", > "/path/to/local/destination_file"); > > Octavian > Also you can use $remotedir = qq(/path/to/remoteserver/dir/); $sftp->cwd($remotedir) || die "CWD to folder outbound failed!: $!", ## OHMONSTER here is the remote file foreach ( $sftp->ls() ) { if (/${$fref}\d+\w+/) { $OHMONSTER = $_; $sftp->get( $OHMONSTER, "$localdir/$OHMONSTER" ) || die "SFTP get from .com failed!: $!", Food fight? Enjoy some healthy debate in the Yahoo! Answers Food & Drink Q&A. http://answers.yahoo.com/dir/?link=list&sid=396545367 Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online. http://smallbusiness.yahoo.com/webhosting -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: CPU/Memory usage of a process on Windows machine
> #!c:/perl/bin/perl.exe > # This is a test scrip > use Win32::Process::Info; > use warnings; > use strict; > my $pi = Win32::Process::Info->new (); > my @process_information = $pi->GetProcInfo(4488); > ## 4488 is pid of a > particular process. > foreach $info (@process_information) { > foreach my $key (keys %{$info}) { > if ($key eq > "WorkingSetSize") { > my > $value = ${$info}{$key}/1024; > print > "$key:=>$value \n" > } > > } > } > > I tried to use a regexp like so and it prints nothing, however I use the PID of the outlook process and it works??? Any help would be appreciated! my $name qr(/out\w+/i); my @process_information = $pi->GetProcInfo($name); Finding fabulous fares is fun. Let Yahoo! FareChase search your favorite travel sites to find flight and hotel bargains. http://farechase.yahoo.com/promo-generic-14795097 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: CPU/Memory usage of a process on Windows machine
You have to add UserModeTime and KernelModeTime then divide by 10,000,000. See: http://www.microsoft.com/technet/scriptcenter/resources/qanda/sept05/hey0922.mspx use Win32::Process::Info; use Data::Dumper; my $pi = Win32::Process::Info->new (); my @process_information = $pi->GetProcInfo(3692); foreach my $info (@process_information) { foreach my $key (keys %{$info}) { if ($key eq "Name" or $key eq "WorkingSetSize" or $key eq "UserModeTime" or $key eq "KernelModeTime") { my $value = ${$info}{$key}; print "\n$key: => $value \n"; } } } ~ Got a little couch potato? Check out fun summer activities for kids. http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: foreach broken in my script
--- "Randal L. Schwartz" <[EMAIL PROTECTED]> wrote: > > ""Jeff" == "Jeff Pang" <[EMAIL PROTECTED]> > writes: > > "Jeff> May you need eval?Like, > > No. Wrong direction for a solution. Don't suggest > things like this. Plenty > of proper answers elsewhere in the thread, so I > won't repeat them. > > DO NOT USE STRING EVAL. EVER. > > Until you understand why I said that. :) Will you kindly explain the logic/reasoning behind this EVER rule? thank you... Got a little couch potato? Check out fun summer activities for kids. http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: "require" question
> When I see code that starts with: > > require 5.6.0; > > Does that mean that the version of Perl can be 5.6.0 > and above or that > it *has to be* 5.6.0? ...that version and above see the output from; perldoc -f require It's here! Your new message! Get new email alerts with the free Yahoo! Toolbar. http://tools.search.yahoo.com/toolbar/features/mail/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
updating Bundle::CPAN in a cygwin XP env
I am running this command: $ perl -MCPAN -e 'install Bundle::CPAN;' and it hangs on the taint check. So I tried it manually and was receiving permission denied errors. See the bottom. snip Checking if your kit is complete... Looks good Writing Makefile for Cwd CPAN: YAML loaded ok (v0.65) snip chmod 644 blib/arch/auto/Cwd/Cwd.bs KWILLIAMS/PathTools-3.25.tar.gz /usr/bin/make -- OK Running make test /usr/bin/perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/crossplatformok 7/50 skipped: various reasons t/cwd..ok t/Functionsok t/rel2abs2rel..ok t/Spec.ok 90/491 skipped: various reasons t/taint $ make install Warning: You do not have permissions to install into /usr/lib/perl5/5.8/cygwin at /usr/lib/perl5/5.8/Ex tUtils/Install.pm line 114. Cannot forceunlink /usr/lib/perl5/5.8/cygwin/auto/Cwd/Cwd.dll: Permission denied at /usr/lib/perl5/5.8/ File/Find.pm line 907 make: *** [pure_perl_install] Error 13 Any help or ideas? thank you Ready for the edge of your seat? Check out tonight's top picks on Yahoo! TV. http://tv.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Timelocal's input parameters
> #!/usr/bin/perl > use strict; > use warnings; > use Time::Local; > > my %month; > @month{ qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct > Nov Dec/ } = 0..11; > > my $date = "Thu Mar 9 23:04:03 2006"; > > my (undef, $month, $day, $h, $m, $s, $year) = split > /\W+/, $date; > > my $time = > timelocal($s,$m,$h,$day,$month{$month},$year); > > print $time,$/; > > print scalar localtime $time; > > > (Prints) > 1141963443 > Thu Mar 9 23:04:03 2006 Jeff, Is this an array of hashes desingnated by { }? my %month; @month{ qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec/ } = 0..11; Moody friends. Drama queens. Your life? Nope! - their life, your story. Play Sims Stories at Yahoo! Games. http://sims.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Timelocal's input parameters
- > No, it is a hash slice. > > my %foo; > @foo{ qw / one two three / } = qw / uno dos tres / ; > > is equivalent to > > my %foo = ( one => 'uno', > two => 'dos', > three => 'tres' ); > > is equivalent to ... > > my %foo; > $foo{one} = 'uno'; > $foo{two} = 'dos'; > $foo{three} = 'tres'; > ok thanks...for clearing that up! Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase. http://farechase.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
slices
Trying to understand from perldoc perldata the diff between these 3 CLIs and why the 2nd CLI has no elements? $ perl -le 'use Data::Dumper; @c = (0,1)[1]; print Dumper([EMAIL PROTECTED]);' $VAR1 = [ 1 ]; $ perl -le 'use Data::Dumper; @c = (0,1)[2]; print Dumper([EMAIL PROTECTED]);' $VAR1 = []; $ perl -le 'use Data::Dumper; @c = (0,1)[0]; print Dumper([EMAIL PROTECTED]);' $VAR1 = [ 0 ]; Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online. http://smallbusiness.yahoo.com/webhosting -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: How do you use Perl?
> > Just be curious to see how do you guys use Perl > for work.Would you be > > pleased to give a vote below? > > > > [a] CGI/Web Development > > [b] System Administration > > [c] mod_perl -- write Apache handler > > [d] write commercial products > > [e] Biological analysis > > [f] others > a and b I use Perl for at work as a Unix (HP, AIX, Sun)admin. Paul, what college? Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out. http://answers.yahoo.com/dir/?link=list&sid=396545433 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Regular Expression Problem
> > like to know why this isn't working. The snippet > of code in question > > is as follows > > > > > > if($ARGV[2] =~ /port/i && $ARGV[3] =~ /nick/i) > > { > > > > Well, on a hunch I'd say that snippet returns false > because either > $ARGV[2] doesn't match /port/i, or because $ARGV[3] > doesn't match / > nick/i. > > If you want more help than that, perhaps you should > post a short-but- > complete script that demonstrates what you're doing. > > Paul Lalli Another hunch looking at your syntax, ideally you should be using the lesser precedence operator 'and' instead of the higher precedence operator '&&'. Yes plz show the command line string. :) if($ARGV[2] =~ /port/i and $ARGV[3] =~ /nick/i) Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Is it wrong...croak vs die...carp vs warn
--- Paul Lalli <[EMAIL PROTECTED]> wrote: > On Aug 13, 2:39 pm, [EMAIL PROTECTED] (Robert Hicks) > wrote: > > I typically "use Carp;" and change my "die" and > "warn" statements to > > "croak" and "carp". I have read a couple places > croak/carp are a little > > better at telling you what and where than the > standard die/warn. > > There is no right or wrong here. croak() and die() > are used for two > different purposes. You use each one when it's > appropriate to use > them. > > In a subroutine or method, you use croak/carp if the > error is > something the caller of your code did wrong. You > use die/warn if the > error is something unexpected in your code. For > example: > > package MyClass; > sub new { >my $class = shift; >my $name = shift or croak "Must pass name > parameter to new() > method!"; >open my $cfg_fh, '<', 'MyClass.cfg' or die > "Unable to open config > file: $!"; >chomp(my $attr = <$cfg_fh>); >my $ref = { name => $name, attr => $attr }; >return bless $ref, $class; > } > > If the user forgets to pass the name parameter to > your class, you need > to tell the user which call to new() it was that has > the error. The > user doesn't care that it happened in line 4 of your > module. > > If the configuration file cannot be opened, you want > to know where in > your module you attempted to open it so you can see > if it has the > right name or whatnot. You don't care where in the > calling code new() > was called. > > Paul Lalli > >From the Perl Review and my understanding as well, use Carp with keywords carp and croak is supposed to provide additional detail in your errors and warnings. Also similar to stating 'use diagnostics;' Pinpoint customers who are looking for what you sell. http://searchmarketing.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Is it wrong...croak vs die...carp vs warn
--- "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Aug 13, 9:33 pm, [EMAIL PROTECTED] (Oryann9) > wrote: > > > From the Perl Review and my understanding as well, > use > > Carp with keywords carp and croak is supposed to > > provide additional detail in your errors and > warnings. > > Perl Review eh? That's foy isn't it? I'm just > reviewing his book > "Mastering Perl" at the moment and the section on > carp/croak seems to > be predicated on (or, at least, likely to impart) > similar > misconceptions. > Yes I was only stating what I read, but now I know the facts. cheers, Luggage? GPS? Comic books? Check out fitting gifts for grads at Yahoo! Search http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
pittsburgh perl
Anyone from this list going? How much was it last year for entry? It does not say how much it is yet at http://pghpw.org/ppw2007/. :) Shape Yahoo! in your own image. Join our Network Research Panel today! http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: manipulating csv file fields through perl
> Something like > #!/usr/bin/perl > use strict; > use DBI; > > my $dbh = > DBI->connect("DBI:CSV:f_dir=/dir/with/the/csvs") > or die "Cannot connect: " . $DBI::errstr; > > $dbh->{'csv_tables'}->{'SomeName'} = { 'file' => > 'SomeName20070827.csv'}; > # tie the table name to the filename > > my $sth = $dbh->prepare('UPDATE SomeName SET Foo = > Foo * Bar'); > $sth->execute(); > # specify an execute the action > > __END__ I read the CPAN module DBD::CSV and still had some questions. 1)Does this create a "in memory" database with data from the spreadsheet for manipulation? 2)This is really cool! Does anyone have a working example of inserting, deleting and substituting data in cells? In the doc it states: $dbh->do("UPDATE $table SET id = 3 WHERE id = 1"); and $dbh->do("DELETE FROM $table WHERE id > 1"); Would $table be the name of the csv file? thank you :) Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: manipulating csv file fields through perl
--- Lawrence Statton <[EMAIL PROTECTED]> wrote: > > I read the CPAN module DBD::CSV and still had some > > questions. > > > > 1)Does this create a "in memory" database with > data > > from the spreadsheet for manipulation? > > What did reading the source tell you? > > > > > 2)This is really cool! Does anyone have a working > > example of inserting, deleting and substituting > data > > in cells? > > Well, since it is a DBI driver, *any* DBI-aware > program could use it, > within the limitations of the subset of SQL that it > supports. > > > > > In the doc it states: > > > > $dbh->do("UPDATE $table SET id = 3 WHERE id = 1"); > > > > and > > > > $dbh->do("DELETE FROM $table WHERE id > 1"); > > > > Would $table be the name of the csv file? > > Lawrence Thank you for replying but since I am trying to learn your response did not help much. :( Any add'l help? Anyway here is what I have tried: #!/usr/bin/perl use strict; use warnings; use DBI; my $dbh = DBI->connect ( "DBI:CSV:f_dir=/cygdrive/c/temp", "DBI:CSV:csv_sep_char=\\;" ) or die "Cannot connect: " . $DBI::errstr; $dbh->{'csv_tables'}->{'data'} = { 'file' => 'UID_CHECK.csv'}; # tie the table name to the filename my $sth = $dbh->prepare("SELECT * FROM data"); $sth->execute() or die "Cannot execute: " . $sth->errstr(); $sth->finish(); $dbh->disconnect(); IN DEBUG MODE: DB<1> n Execution ERROR: No such column 'PL.1,'. at /usr/lib/perl5/site_perl/5.8/SQL/Statement.pm line 2052 SQL::Statement::do_err('DBD::CSV::Statement=HASH(0x1093cc54)', 'No such column \'PL.1,\'') call ed at /usr/lib/perl5/site_perl/5.8/SQL/Statement.pm line 1665 SQL::Statement::verify_columns('DBD::CSV::Statement=HASH(0x1093cc54)', 'DBI::st=HASH(0x10953cf0 )', 'SQL::Eval=HASH(0x1096386c)', 'ARRAY(0x10852618)') called at /usr/lib/perl5/site_perl/5.8/SQL/State ment.pm line 778 SQL::Statement::SELECT('DBD::CSV::Statement=HASH(0x1093cc54)', 'DBI::st=HASH(0x10953cf0)', 'ARR AY(0x10957424)') called at /usr/lib/perl5/site_perl/5.8/SQL/Statement.pm line 196 SQL::Statement::execute('DBD::CSV::Statement=HASH(0x1093cc54)', 'DBI::st=HASH(0x10953cf0)', 'AR RAY(0x10957424)') called at /usr/lib/perl5/site_perl/5.8/cygwin/DBD/File.pm line 441 eval {...} called at /usr/lib/perl5/site_perl/5.8/cygwin/DBD/File.pm line 441 DBD::File::st::execute('DBI::st=HASH(0x10953cf0)') called at csv_manip.plx line 19 main::(csv_manip.plx:20): $sth->finish(); DB<1> Luggage? GPS? Comic books? Check out fitting gifts for grads at Yahoo! Search http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Net::DNS::Resolver
All, Why is it when I turn off debug mode, I get no output? I was expecting output similar to what nslookup shows for a simple query. My goal is to look up by NAME and by IP within 2 domains to determine success and failure. use strict; use warnings; use Carp; my $res = Net::DNS::Resolver->new( nameservers => [qw(n.com x.com)], recurse => 0, debug => 1, ); my $query = $res->query("CLIENT IP"); if ($query) { foreach my $rr ($query->answer) { next unless $rr->type eq "A"; ## Skip if not a host address record ## print $rr->address, "\n"; } } else { warn "query failed: ", $res->errorstring, "\n"; } thank you! __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Net::DNS::Resolver
> Why is it when I turn off debug mode, I get no output? What output do you get when you don't turn off debug? -- I found what is causing this, $query is 'undef' So was it the intent of the person who wrote this module to have this code act in this way? Do you have a recommendation on how to make this more usable in terms of success/failure lookups for client nodes for each BIND server? my $query = $res->query("CLIENT_IP"); use Data::Dumper; print Dumper($query); using Data::Dumper with debug off I get: $VAR1 = undef; but with debug on, I seem to get an answer __OUTPUT__ ;; query(x.x.x.x) ;; setting up an AF_INET() family type UDP socket ;; send_udp(x.x.x.x) ;; answer from x.x.x.x:53 : 43 bytes ;; HEADER SECTION ;; id = 6637 ;; qr = 1opcode = QUERYaa = 0tc = 0rd = 0 ;; ra = 1ad = 0cd = 0rcode = SERVFAIL ;; qdcount = 1 ancount = 0 nscount = 0 arcount = 0 ;; QUESTION SECTION (1 record) ;; x.x.x.x.in-addr.arpa. IN PTR ;; ANSWER SECTION (0 records) ;; AUTHORITY SECTION (0 records) ;; ADDITIONAL SECTION (0 records) RCODE: SERVFAIL; trying next nameserver ;; send_udp(x.x.x.x:53) ;; answer from x.x.x.x:53 : 474 bytes ;; HEADER SECTION ;; id = 6637 ;; qr = 1opcode = QUERYaa = 0tc = 0rd = 0 ;; ra = 1ad = 0cd = 0rcode = NOERROR ;; qdcount = 1 ancount = 0 nscount = 13 arcount = 13 ;; QUESTION SECTION (1 record) ;; x.x.x.x.in-addr.arpa. IN PTR ;; ANSWER SECTION (0 records) ;; AUTHORITY SECTION (13 records) . 10302 IN NS i.root-servers.net. . 10302 IN NS g.root-servers.net. . 10302 IN NS k.root-servers.net. . 10302 IN NS b.root-servers.net. . 10302 IN NS c.root-servers.net. . 10302 IN NS f.root-servers.net. . 10302 IN NS e.root-servers.net. . 10302 IN NS d.root-servers.net. . 10302 IN NS m.root-servers.net. . 10302 IN NS l.root-servers.net. . 10302 IN NS j.root-servers.net. . 10302 IN NS a.root-servers.net. . 10302 IN NS h.root-servers.net. ;; ADDITIONAL SECTION (13 records) i.root-servers.net. 10302 IN A 192.36.148.17 g.root-servers.net. 10302 IN A 192.112.36.4 k.root-servers.net. 10302 IN A 193.0.14.129 b.root-servers.net. 10302 IN A 192.228.79.201 c.root-servers.net. 10302 IN A 192.33.4.12 f.root-servers.net. 10302 IN A 192.5.5.241 e.root-servers.net. 10302 IN A 192.203.230.10 d.root-servers.net. 10302 IN A 128.8.10.90 m.root-servers.net. 10302 IN A 202.12.27.33 l.root-servers.net. 10302 IN A 198.32.64.12 j.root-servers.net. 10302 IN A 192.58.128.30 a.root-servers.net. 10302 IN A 198.41.0.4 h.root-servers.net. 10302 IN A 128.63.2.53 $VAR1 = undef; __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Net::DNS::Resolver
What output do you get when you don't turn off debug? -- I found what is causing this, $query is 'undef' So was it the intent of the person who wrote this module to have this code act in this way? Do you have a recommendation on how to make this more usable in terms of success/failure lookups for client nodes on each BIND server? my $query = $res->query("CLIENT_IP"); use Data::Dumper; print Dumper($query); using Data::Dumper with debug off I get: $VAR1 = undef; but with debug on, I seem to get an answer __OUTPUT__ ;; query(x.x.x.x) ;; setting up an AF_INET() family type UDP socket ;; send_udp(x.x.x.x) ;; answer from x.x.x.x:53 : 43 bytes ;; HEADER SECTION ;; id = 6637 ;; qr = 1opcode = QUERYaa = 0tc = 0rd = 0 ;; ra = 1ad = 0cd = 0rcode = SERVFAIL ;; qdcount = 1 ancount = 0 nscount = 0 arcount = 0 ;; QUESTION SECTION (1 record) ;; x.x.x.x.in-addr.arpa. IN PTR ;; ANSWER SECTION (0 records) ;; AUTHORITY SECTION (0 records) ;; ADDITIONAL SECTION (0 records) RCODE: SERVFAIL; trying next nameserver ;; send_udp(x.x.x.x:53) ;; answer from x.x.x.x:53 : 474 bytes ;; HEADER SECTION ;; id = 6637 ;; qr = 1opcode = QUERYaa = 0tc = 0rd = 0 ;; ra = 1ad = 0cd = 0rcode = NOERROR ;; qdcount = 1 ancount = 0 nscount = 13 arcount = 13 ;; QUESTION SECTION (1 record) ;; x.x.x.x.in-addr.arpa. IN PTR ;; ANSWER SECTION (0 records) ;; AUTHORITY SECTION (13 records) . $VAR1 = undef; A manual nslookup does work : # nslookup Default Server: xxx.xxx.xxx.com Address: 10..xx.xx.xx > server ns7.xx.com Default Server: ns7.xx.com Address: xx.xx.xx.xx > 10.8.xx.xx## Client IP Server: ns7.xx.com Address: xx.xx.xx.xx Name:xxx.xxx.xxx.com Address: 10.xx.xx.254 > server xxx.xxx.xxx.com Default Server: xxx.xxx.xxx.com Address: 10.220.xx.xx > 10.8.xx.xx ## Client IP Server: xx.xx.xx.com Address: 10.220.13.132 Name:xxx.xxx.xxx.com Address: 10.8.xx.xx __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: getting nth column of a string
is there a way to get the "nth" column of a string in perl, similar to awk '{print $col_no}' in awk ? ### There are multiple ways, but here are two examples: In the first example, split is what you need to pay attention to. In the second example, @F is the key here. $ perl -le 'my $string = qq(a b c d); print $string; print +(split)[2,3], for $string;' a b c d cd $ echo "a b c d"| perl -nae 'print "@F[2,3]\n";' c d __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
outlook module
All, I am looking for some humble advice. I keep getting annoying emails using the mail client 'Outlook 2003 SP2.' These messages are intended for another person in my company with the same name as I. Not to my surprise, the email support group decided to give this person an email address that only differs by one character, I was here prior to my clone. I want to parse these .msg, files look for certain keywords, if these keywords are found compose a reply email that contains a pre-written message template to the original sender. What module will fit my needs? Thank you __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: outlook module
> I am looking for some humble advice. I keep getting annoying emails using the mail client 'Outlook 2003 SP2.' These messages are intended for another > person in my company with the same name as I. Not to my surprise, the email support group decided to give this person an email address that only differs > by one character, I was here prior to my clone. I want to parse these .msg, files look for certain keywords, if these keywords are found compose a reply > email that contains a pre-written message template to the original sender. > What module will fit my needs? >It seems to me that your network admins need to correct their faulty >procmail routing recipes. It should not be your job to deal with this. >Do the network admins have any idea how big a problem this is? Not only >for your inconvenience, but for the other person not receiving messages? >Jo ## I have informed them, however they apparently do not care. As a courtesy, I do forward these specific emails on, but want to automate this "courtesy" process. What module(s) do you recommended? I am using cygwin 1.5.24 and Perl 5.8.8 __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: outlook module
- Original Message From: oryann9 <[EMAIL PROTECTED]> To: Perl List Sent: Thursday, November 1, 2007 1:02:35 PM Subject: Re: outlook module > I am looking for some humble advice. I keep getting annoying emails using the mail client 'Outlook 2003 SP2.' These messages are intended for another > person in my company with the same name as I. Not to my surprise, the email support group decided to give this person an email address that only differs > by one character, I was here prior to my clone. I want to parse these .msg, files look for certain keywords, if these keywords are found compose a reply > email that contains a pre-written message template to the original sender. > What module will fit my needs? >It seems to me that your network admins need to correct their faulty >procmail routing recipes. It should not be your job to deal with this. >Do the network admins have any idea how big a problem this is? Not only >for your inconvenience, but for the other person not receiving messages? >Jo ## I have informed them, however they apparently do not care. As a courtesy, I do forward these specific emails on, but want to automate this "courtesy" process. What module(s) do you recommended? I am using cygwin 1.5.24 and Perl 5.8.8 -- After some CPAN browsing it looks like Mail::Outlook Module Version: 0.13 fits the bill, unless someone has any trade-secrets? __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Split string into array
Tom I thought taking a string and assigning it to an array would do it and I was wrong. Here is a sample line of source; "2004-08-03 23:57 1,712,128 GdiPlus.dll" and the recommended split gives me 13 for the number of items. I would like an array that has "2004-08-03", "23:57","1,712,128","GdiPlus.dll" as the elements of the array. Thanks, Andrew At 17:40 2007-11-17, Tom Phoenix wrote: >On 11/16/07, AndrewMcHorney <[EMAIL PROTECTED]> wrote: > > > I now got my directory listing into an array of strings. I would like > > to now split up the string into a an array of strings from the > > original string. For example, I might have a string of "a b c d" > > and I now want a 4 element array containing "a", "b", "c", 'd". > > > > I did the following but it did not work. > > > > @new_dir = @string_array[$index]; > >What's wrong with it? Was that just some Perl-like code that you typed >at random, or was there some reason to think that it would do what you >want? > > > The new_dir array is the string from the string array. > > > > Where did I go wrong? > >Do you want split? > > my @pieces = split / /, "a b c d"; > >I feel that I'm guessing (badly?) at what you want. Am I close? If >you're not trying to break up a string on space, what are you trying >to do? > >Hope this helps! > >--Tom Phoenix >Stonehenge Perl Training > Tom is right as usual, so not sure what you are confused about. /etc/skel$ perl -le 'my $string=q/2004-08-03 23:57 1,712,128 GdiPlus.dll/;print "\n$string\n"; > my @array=split /\s/, $string; print @array;' 2004-08-03 23:57 1,712,128 GdiPlus.dll 2004-08-0323:571,712,128GdiPlus.dll /etc/skel$ perl -le 'my $string=q/2004-08-03 23:57 1,712,128 GdiPlus.dll/;print "\n$string\n"; my @array=split /\s/, $string; print $array[2];' 2004-08-03 23:57 1,712,128 GdiPlus.dll 1,712,128 # # The meaning of split # # split / /, $foo; and split ' ', $foo; are not the same thing. split ' ', $foo is a special case that means to split on all sequences of whitespace. It means the same thing as split /\s+/, $foo; Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: outlook module
Why not just create a message filter or rule or whatever Outlook calls it (or multiple ones for various criteria)? > > I did and it I cannot get it to work. Be a better pen pal. Text or chat with friends inside Yahoo! Mail. See how. http://overview.mail.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
file::find
Perl'ers, In my code I call a find routine called xyz based on what the user enters which can be "/" or /\w+. Instead of having one block of code and another block of the same code, but with $File::Find::prune = 1; can't I just pass this $File::Find::prune = 1; to my single find routine based on their entry? use strict; use warnings; use File::Find ; use File::Find::Closures qw(find_by_min_size) ; chomp (my $fs = <>) ; if ( $fs =~ m|\x2f{1}?|g ) { ##-- if "/" is matched --# $File::Find::prune = 1; find_me; } elsif ( $fs !~ m|\/\w+| ) { find_me; find_me { my @directory = ($fs) ; use constant MAX_SIZE => (25*1024*1024) ; use constant DIVISOR => (1024) ; my ( $wanted, $list ) = find_by_min_size ( MAX_SIZE ) ; File::Find::find ( { wanted => $wanted, }, @directory ) ; } thank you Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
find2perl
In find2perl, prune is set to 1 for true as in DO NOT desend dirs? From the man page "-prune" Do not descend into the directory currently matched. Likewise for File::Find prune set to 1? $ find2perl /dirname -size +4092k -ls -prune thank you Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: find2perl
oryann9> $ find2perl /dirname -size +4092k -ls -prune Since -prune is *after* the condition of -size, you're setting prune only for VERY VERY LARGE directories. Is that your intent? -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! No, but good point. My intent was to determine when -prune was set on the CLI what the De-parsed code told me, 1==true, 0==false because when I run this code below prune = 0 is not working, its descending down "/". use strict ; use warnings ; use File::Find ; use File::Find::Closures qw(find_by_min_size) ; find_me ( $fs, 0 ); sub find_me { use Data::Dumper; my $fs = shift; print "FS from sub\t$fs\n"; print Dumper(local $File::Find::prune = shift); ##-- localize prune to just this block --## use constant MAX_SIZE => (25*1024*1024) ; use constant DIVISOR => (1024) ; my ( $wanted, $list ) = find_by_min_size ( MAX_SIZE ) ; File::Find::find ( { wanted => $wanted, }, $fs ) ; @large_files = $list->() ; @sorted_large_files = sort { -s $b <=> -s $a } @large_files ; } ##-- End sub --## thx for the reply! Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: find2perl
oryann9> No, but good point. My intent was to determine when -prune was set on oryann9> the CLI what the De-parsed code told me, 1==true, 0==false because oryann9> when I run this code below prune = 0 is not working, its descending oryann9> down "/". You're misusing it. Set it within the wanted() routine when you're looking at a directory that you don't want to descend. It'll be cleared to 0 before calling wanted(), so setting it before calling find() is completely useless. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. - __OUTPUT__ main::(find_hog:47):if ( $fs eq "/" ) { # only if the root directory DB<1> print $fs / DB<2> n main::(find_hog:48):find_me ( $fs, 0 ); DB<2> n print caller find_me main::(find_hog:61):my ( @sorted_large_files, @large_files ) ; DB<2> main::(find_hog:80):if (@sorted_large_files) { DB<2> print caller find_me invalid top directory at /opt/perl/lib/5.8.2/File/Find.pm line 568, <> line 1. DB<3> print $fs / DB<4> n main::(find_hog:81):my %meta ; DB<4> n main::(find_hog:82):for my $file (@sorted_large_files) { DB<4> n main::(find_hog:83):$meta{$file} = { main::(find_hog:84): 'uid' => (stat($file))[4], main::(find_hog:85): 'gid' => (stat($file))[5], main::(find_hog:86): 'sz' => (stat($file))[7], main::(find_hog:87): 'mod' => (stat($file))[9], DB<4> print $file /data/data01/recovery/archives/dubhdv04/2007-11-15,11:21 DB<5> /data/... should not be appearing if prune set to false, or 0. __CODE__ Is this what you mean on line 9? I tried and it does not seem to work, meaning it still descending. 1 sub find_me { 2 use Data::Dumper; 3 my $fs = shift; 4 #local $File::Find::prune = shift; ##-- localize prune to just this block --## 5 #my @directory = ($fs) ; 6 use constant MAX_SIZE => (25*1024*1024) ; 7 use constant DIVISOR => (1024) ; 8 my ( $wanted, $list ) = find_by_min_size ( MAX_SIZE ) ; 9 File::Find::find ( { wanted => $wanted, prune => $File::Find::prune = shift}, $fs ) ; 10@large_files = $list->() ; 11 12@sorted_large_files = 13 sort { -s $b <=> -s $a } 14@large_files ; 15 16 } ##-- End sub --## Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: split then match, regex better?
Happy New Year. I have a series of values with the following form: TO_Chr10_final.txt I would like to obtain the value 10, for accounting purposes: my $chr = ( split /_/ , $value ) [ 1 ] ; $chr =~ /chr/i ; $chr = $' ; This seems convoluted. Could someone please criticize this approach or offer a better one? - yes there is many ways, but I like this one. $ perl -le 'my $str=qq(TO_Chr10_final.txt); my @arr = unpack("A2" x (length($str) >> 1), $str); print grep {/^\d+$/} @arr;' 10 Does that help? : ) Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: find2perl
>You're misusing it. Set it within the wanted() routine when you're >looking at >a directory that you don't want to descend. It'll be cleared to 0 >before >calling wanted(), so setting it before calling find() is completely >useless. >-- >Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 >0095 ><[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/> >Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. - Is this what you mean on line 9? I tried and it does not seem to work, meaning it still descending. 1 sub find_me { 2 use Data::Dumper; 3 my $fs = shift; 4 #local $File::Find::prune = shift; ##-- localize prune to just this block --## 5 #my @directory = ($fs) ; 6 use constant MAX_SIZE => (25*1024*1024) ; 7 use constant DIVISOR => (1024) ; 8 my ( $wanted, $list ) = find_by_min_size ( MAX_SIZE ) ; 9 File::Find::find ( { wanted => $wanted, prune => $File::Find::prune = shift}, $fs ) ; 10@large_files = $list->() ; 11 12@sorted_large_files = 13 sort { -s $b <=> -s $a } 14@large_files ; 15 16 } ##-- End sub --## Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: find2perl
- Original Message From: oryann9 <[EMAIL PROTECTED]> To: beginners@perl.org Sent: Friday, January 11, 2008 2:32:11 PM Subject: Re: find2perl >You're misusing it. Set it within the wanted() routine when you're >looking at >a directory that you don't want to descend. It'll be cleared to 0 >before >calling wanted(), so setting it before calling find() is completely >useless. >-- >Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 >0095 ><[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/> >Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. - Will anyone help me with this issue? These three lines of code work, but work in a way that I am not expecting. When I tell this module to set no_chdir to 1 it should NOT descend directories yet it does. Am I supposed to have a wanted routine other than whats below? Below are the 3 lines I have tried and below that is the entire script. thank you! 1) File::Find::find ( { wanted => $wanted, no_chdir => $File::Find::no_chdir }, $fs ) ; 2) File::Find::find ( { wanted => $wanted, no_chdir => +shift }, $fs ) ; 3) File::Find::find ( { wanted => $wanted, no_chdir => $File::Find::no_chdir = shift}, $fs #!/usr/bin/perl use strict ; use warnings ; use File::Find ; use File::Find::Closures qw(find_by_min_size) ; ##-- Begin Format Code --## my ($key,$user,$grp,$mod,$sz) ; format STDOUT_TOP = Page @<<< $% FileName OwnerGroupOwner LastMo ate Size = === === == = . format STDOUT = @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<< @<<<<<< @<<<<< <<< @##.### $key, $user, $grp,date_m , $sz . ##-- End Format Code --## sub date_me { my $mod = shift @_ ; my ($seconds, $minutes, $hours, $day_of_month, $month, $year, undef, undef, undef) = localtime($mod) ; #printf("%02d:%02d:%02d-%02d/%02d/%04d", ( $hours, $minutes, $seconds, $month+1, $day_of_month, $year+1900 ) ; } my $log = qq(/var/adm/find_hog.log) ; my $logg ; open ($logg, '>>', $log) or warn "file '$logg' was not opened $!" ; START: print qq (\nPlease enter filesystem name in the form of /fsname or / just for root\n) ; print "\n"; chomp (my $fs = <>) ; if ( $fs eq "/" ) { # only if the root directory, do not descend. find_me ( $fs, 0 ); } elsif ( $fs =~ m|^/\w+|i ) { ## matches /var find_me ( $fs, 1 ); } elsif ( $fs =~ m|^[/.\w+]|i ) { ## matches /.ssh find_me ( $fs, 1 ); } else { warn "\nFilesystem name does not match expression.\nPlease contact Unix on call and or try again\n goto START; } my ( @sorted_large_files, @large_files ) ; sub find_me { use Data::Dumper; my $fs = shift; #local $File::Find::prune = shift; ##-- localize prune to just this block --## #my @directory = ($fs) ; use constant MAX_SIZE => (25*1024*1024) ; use constant DIVISOR => (1024) ; my ( $wanted, $list ) = find_by_min_size ( MAX_SIZE ) ; File::Find::find ( { wanted => $wanted, no_chdir => +shift }, $fs ) ; @large_files = $list->() ; @sorted_large_files = sort { -s $b <=> -s $a } @large_files ; } ##-- End sub --## if (@sorted_large_files) { my %meta ; for my $file (@sorted_large_files) { $meta{$file} = { 'uid' => (stat($file))[4], 'gid' => (stat($file))[5], 'sz' => (stat($file))[7], 'mod' => (stat($file))[9], } ; } ## END FOR ## for $key ( keys %meta ) { $user = getpwuid $meta{$key}->{'uid'} ; $grp = getgrgid $meta{$key}->{'gid'} ; $mod = $meta{$key}{'mod'} ; $sz = $meta{$key}{'sz'} / DIVISOR / DIVISOR ; #print "\n$key => $user\t$grp\t\t" ; #date_me($mod) ; #printf("\t%0.3f Mb\n",$sz) ; write ; } } ##-- End @sorted_large_files if --## else { warn "\nNo file(s) over twenty-five Mb found in $fs\n" ; exit 0 ; } END { close ($logg) or warn "Log '$logg' failed to close $!" ; } Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: find2perl
- Will anyone help me with this issue? These three lines of code work, but work in a way that I am not expecting. When I tell this module to set no_chdir to 1 it should NOT descend directories yet it does. Am I supposed to have a wanted routine other than whats below? Below are the 3 lines I have tried and below that is the entire script. thank you! 1) File::Find::find ( { wanted => $wanted, no_chdir => $File::Find::no_chdir }, $fs ) ; 2) File::Find::find ( { wanted => $wanted, no_chdir => +shift }, $fs ) ; 3) File::Find::find ( { wanted => $wanted, no_chdir => $File::Find::no_chdir = shift}, $fs #!/usr/bin/perl use strict ; use warnings ; use File::Find ; use File::Find::Closures qw(find_by_min_size) ; ##-- Begin Format Code --## my ($key,$user,$grp,$mod,$sz) ; ##-- End Format Code --## sub date_me { my $mod = shift @_ ; my ($seconds, $minutes, $hours, $day_of_month, $month, $year, undef, undef, undef) = localtime($mod) ; #printf("%02d:%02d:%02d-%02d/%02d/%04d", ( $hours, $minutes, $seconds, $month+1, $day_of_month, $year+1900 ) ; } my $log = qq(/var/adm/find_hog.log) ; my $logg ; open ($logg, '>>', $log) or warn "file '$logg' was not opened $!" ; START: print qq (\nPlease enter filesystem name in the form of /fsname or / just for root\n) ; print "\n"; chomp (my $fs = <>) ; if ( $fs eq "/" ) { # only if the root directory, do not descend. find_me ( $fs, 0 ); } elsif ( $fs =~ m|^/\w+|i ) { ## matches /var find_me ( $fs, 1 ); } elsif ( $fs =~ m|^[/.\w+]|i ) { ## matches /.ssh find_me ( $fs, 1 ); } else { warn "\nFilesystem name does not match expression.\nPlease contact Unix on call and or try again\n goto START; } my ( @sorted_large_files, @large_files ) ; sub find_me { use Data::Dumper; my $fs = shift; #local $File::Find::prune = shift; ##-- localize prune to just this block --## #my @directory = ($fs) ; use constant MAX_SIZE => (25*1024*1024) ; use constant DIVISOR => (1024) ; my ( $wanted, $list ) = find_by_min_size ( MAX_SIZE ) ; File::Find::find ( { wanted => $wanted, no_chdir => +shift }, $fs ) ; @large_files = $list->() ; @sorted_large_files = sort { -s $b <=> -s $a } @large_files ; } ##-- End sub --## -- Will / Can anyone help, pretty please? Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: find2perl
- Original Message From: Randal L. Schwartz <[EMAIL PROTECTED]> To: oryann9 <[EMAIL PROTECTED]> Sent: Thursday, January 17, 2008 6:39:35 PM Subject: Re: find2perl The following message is a courtesy copy of an article that has been posted to perl.beginners as well. >>>>> "oryann9" == oryann9 <[EMAIL PROTECTED]> writes: oryann9> Will anyone help me with this issue? These three lines of code work, oryann9> but work in a way that I am not expecting. Then you aren't reading the docs, or listening to anyone's help here. Not only that, you've been rude by reposting your problem in another forum <http://www.perlmonks.org/index.pl?node_id=662699> without disclosing that you've been getting help here, but ignoring the answers. This wastes the time of people VOLUNTEERING their time in BOTH places. Rude. The best thing you can do at this point is to hire a programmer, who will either know how to read the docs for you, or can ask us in a way that won't ignore our answers. -- The reason why I post here and at perlmonks is b/c both are good to learn from. Who say I have to disclose what I post at perlmonks??? Not everyone use both resources. No one from perlmonks seems to know the answer either, likewise here. I have read the docs and practiced, but with no success. Sorry for asking for help, after all isn't that what this list is for? I think you are the one being Rude, not me. Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: find2perl
Original Message From: Randal L. Schwartz <[EMAIL PROTECTED]> To: oryann9 <[EMAIL PROTECTED]> Cc: Perl List Sent: Thursday, January 17, 2008 7:04:40 PM Subject: Re: find2perl >>>>> "oryann9" == oryann9 <[EMAIL PROTECTED]> writes: oryann9> No one from perlmonks seems to know the answer either, likewise here. This is a lie. If you don't see that it's a lie, then no amount of answering in EITHER place will HELP you. Hire a programmer, please. -- I am not a liar! I am a Christian and the only little help I have received is: If you don't want to descend into any directories, then you are likely better off with opendir/readdir/closedir or glob. If you don't want to descend into certain directories, then you set $File::Find::prune to 1 inside your wanted subroutine when the current directory is one you do not want to descend into. First, there is no 'prune' option that you can pass in to File::Find::find(). Second, you have to set $File::Find::prune to one (not zero). Third, you have to set it from within your "wanted" subroutine when the traversal gets to a directory that you don't want the traversal to descend into. In your case, you appear to want to have your "wanted" subroutine always set $File::Find::prune= 1; so no subdirectories are traversed into. So after this I practiced and tried with no success. How does anyone in the community expect people to learn or like this language if there are responses in this way? I will not argue, please do not respond. thank you. P.S. Apologizes for not knowing I was supposed to disclose to this list I use perlmonks, gesz. Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
undefined format error
Hello List, I am hoping for some help with this. I did post this same question to PerlMonks. Undefined format "STDOUT" called at find_hog.tdy line 173. Line 173 is the 1st write statement, but since there are snips in there 173 is not the actual line in this email. Just look for 1st write statement. thank you. :) #!/usr/bin/perl use strict ; use warnings ; use File::Find ; use File::Find::Closures qw(find_by_min_size) ; $ENV{"PATH"} = qq(/usr/bin:/bin) ; delete @ENV{qw (IFS CDPATH KSH_ENV)} ; my ( $key, $keys, $user, $grp, $gcos, $mod, $mod2, $sz, ) ; my ( @sorted_large_files, @sorted_root_files, ); sub dateme { ##-- $mod is for modification time from file(s) --## my $mod = shift @_ ; my ($seconds, $minutes, $hours, $day_of_month, $month, $year,undef,undef, undef ) = localtime( $mod ) ; ##-- $mod2 is like $mod, but does more, allows user to see mod time from sprintf --## my $mod2 = sprintf( "%02d:%02d:%02d-%02d/%02d/%02d", ( $hours, $minutes, $seconds, $month + 1, $day_of_month, ( $year % 100 ) ) ) ; } ##-- Begin Main --## #===# print qq(\n) ; my $fs = $ARGV[0] ; my $size = ( $ARGV[1] * 1024 * 1024 ) ; $fs =~ tr /\000//d ;##-- Clean user input --## $size =~ tr /\000//d ; die qq ( \nPlease enter filesystem followed by minimum file size to search. Usage example: find_hog /var 25 will look in /var for files >= 25Mb\n\n ), unless ( $fs and $size ) ; my ( @root_files, @large_files, ) ; if ( $fs eq "/" ) {## only if the root directory } elsif ( $fs =~ m|^/\w+|i ) {## matches /var find_me( $fs, $size, 0 ) ; } elsif ( $fs =~ m|^[/.\w+]|i ) {## matches /.ssh find_me( $fs, $size, 0 ) ; } sub find_me { my $fs = shift @_ ; my $size = shift @_ ; my ( $wanted, $list ) = find_by_min_size( $size ) ; File::Find::find( { wanted => $wanted, no_chdir => +shift }, $fs ) ; @large_files = $list->() ; } ##-- End sub --## ##-- Gather meta-data --## #=# use constant DIVISOR=> ( 1024 ) ; use constant LINES_PER_PAGE => ( 44 ) ; if ( @large_files ) { my %meta ; for my $file ( @large_files ) { $meta{$file} = { 'uid' => ( stat( $file ) )[4], 'gid' => ( stat( $file ) )[5], 'sz' => ( stat( $file ) )[7], 'mod' => ( stat( $file ) )[9], } ; } ##-- End For --## for $key ( keys %meta ) { $user= qq(N/A) unless $user = (getpwuid ( $meta{$key}->{'uid'} ) )[0] ; ##-- uid name --## $grp = qq(N/A) unless $grp = (getgrgid ( $meta{$key}->{'gid'} ) )[0] ; ##-- gid name --## $gcos= qq(N/A) unless $gcos = (getpwuid ( $meta{$key}->{'uid'} ) )[6] ; ##-- gcos --## $mod = qq(N/A) unless $mod = $meta{$key}{'mod'} ; $sz = qq(N/A) unless $sz = $meta{$key}{'sz'} / DIVISOR / DIVISOR ; my $ofh = select( STDOUT ) ; $= = LINES_PER_PAGE ; select( $ofh ) ; write ; ## THIS IS WHERE THE ERROR IS ## $ofh = select( LOG ) ; $= = LINES_PER_PAGE ; select( $ofh ) ; write( $ofh ) ; } ##-- End For --## ##-- Sort values according to sz --## @sorted_large_files = sort { $meta{$b}->{'sz'} <=> $meta{$a}->{'sz'} } keys %meta; } ##-- End @large_files if --## ##-- Begin Format Code --## #==# $^L = q{}; format STDOUT_TOP = REPORT OF LARGE FILES on: @<< qx(hostname) Page @<<< $% FileName OwnerGroupOwner Gecos LastModifiedDate Size Mb = === === === === . format STDOUT = @< @<<< @<<@<<< @| @##.## @sorted_large_files, dateme($mod,$mod2) . ##-- End Format Code --## ## else { warn "\nNo file(s) over $size Mb found in $fs\n" ; exit 0 ; } #print "\n"; #print join("\n",@sorted_large_files); #print join("\n",@sorted_root_files); END { close( LOG ) or warn "Log '$log' failed to close $!" ; } Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ -- To unsubscribe, e-mail: [EMAIL PROTECT
Re: undefined format error
Please ignore the message below b/c I worked through this. Basically my format code is not printing in a sorted order based off of 'sz' yet it is correctly sorted in @sorted_large_files as you can see below SORTED. How can I tell format to print it sorted based off of 'sz'? Here is how I am sorting @sorted_large_files = sort { $meta{$b}->{'sz'} <=> $meta{$a}->{'sz'} } keys %meta ; REPORT OF LARGE FILES on: "hostname x" Page 1 FileName Owner GroupOwner Gecos LastModifiedDateSize Mb = === === == = === /var/opt/ignite/media/image.iso root sys N/A17:01:21-09/27/06 98.84 /var/opt/ignite/media/pseudo_root/bootvol.lifroot sys N/A17:01:20-09/27/06 98.49 /var/opt/ignite/clients/0x001321EAA5D2/recovery/2007-11-16,22:02/flist bin sys N/A01:03:24-11/17/07 33.47 /var/opt/ignite/clients/0x001321EAA5D2/recovery/2007-10-16,23:39/flist bin sys N/A02:40:23-10/17/07 32.28 /var/opt/ignite/clients/0x001321EAA5D2/recovery/2007-12-16,22:02/flist bin sys N/A01:03:16-12/17/07 36.58 /var/opt/ignite/clients/0x00306E3842AF/recovery/2008-01-15,05:43/flist bin sys N/A05:44:15-01/15/08 34.33 /var/opt/ignite/clients/0x00306E4B4C3A/recovery/2008-01-15,09:44/flist bin sys N/A09:46:49-01/15/08 28.84 /var/adm/sw/save/PHCO_34255/VXVM-RUN/etc/vx/static.d/build/vold.obin bin N/A03:13:11-10/06/04 28.00 /var/opt/ignite/clients/0x00306E3842AF/recovery/2007-12-15,07:49/flist bin sys N/A07:50:10-12/15/07 34.30 /var/opt/ignite/clients/0x001321EAA5D2/recovery/2008-01-16,23:50/flist bin sys N/A02:50:59-01/17/08 37.92 /var/opt/ignite/clients/0x00306E4B2BA4/recovery/2008-01-16,06:16/flist bin sys N/A06:18:46-01/16/08 65.12 SORTED /var/opt/ignite/media/image.iso /var/opt/ignite/media/pseudo_root/bootvol.lif /var/opt/ignite/clients/0x00306E4B2BA4/recovery/2008-01-16,06:16/flist /var/opt/ignite/clients/0x001321EAA5D2/recovery/2008-01-16,23:50/flist /var/opt/ignite/clients/0x001321EAA5D2/recovery/2007-12-16,22:02/flist /var/opt/ignite/clients/0x00306E3842AF/recovery/2008-01-15,05:43/flist /var/opt/ignite/clients/0x00306E3842AF/recovery/2007-12-15,07:49/flist /var/opt/ignite/clients/0x001321EAA5D2/recovery/2007-11-16,22:02/flist /var/opt/ignite/clients/0x001321EAA5D2/recovery/2007-10-16,23:39/flist /var/opt/ignite/clients/0x00306E4B4C3A/recovery/2008-01-15,09:44/flist /var/adm/sw/save/PHCO_34255/VXVM-RUN/etc/vx/static.d/build/vold.o - Original Message From: oryann9 <[EMAIL PROTECTED]> To: Perl List Sent: Thursday, January 31, 2008 4:57:10 PM Subject: undefined format error Hello List, I am hoping for some help with this. I did post this same question to PerlMonks. Undefined format "STDOUT" called at find_hog.tdy line 173. Line 173 is the 1st write statement, but since there are snips in there 173 is not the actual line in this email. Just look for 1st write statement. thank you. :) #!/usr/bin/perl use strict ; use warnings ; use File::Find ; use File::Find::Closures qw(find_by_min_size) ; $ENV{"PATH"} = qq(/usr/bin:/bin) ; delete @ENV{qw (IFS CDPATH KSH_ENV)} ; my ( $key, $keys, $user, $grp, $gcos, $mod, $mod2, $sz, ) ; my ( @sorted_large_files, @sorted_root_files, ); ##-- Begin Format Code --## #==# $^L = q{}; format STDOUT_TOP = REPORT OF LARGE FILES on: @<<<<<<<<<< qx(hostname) Page @<<< $% FileName Owner GroupOwner Gecos LastModifiedDate Size Mb = === === == = === . format STDOUT = @<<<<<<<<<<<<&
website
Does anyone know what happened to this website: http://web.archive.org/web/20041123005900/http://www.raycosoft.com/rayco/support/perl_tutor.html It says its not available. I thought it was a great reference and explained the diffs between map and grep and even sort. Does anyone have a softcopy of its data that you can send me? thank you! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: reg exp continued need pulled from reference
"Dr.Ruud" <[EMAIL PROTECTED]> wrote:Lawrence Statton XE2/N1GAK schreef: > @{$aref2}[0] is 'sun' ITYM: ${$aref2}[0] is 'sun' -- Affijn, Ruud "Gewoon is een tijger." -- Ok everyone, I have thought about this one and tried various code changes but cannot get what I want. My problem: redundant UIDs in password files. My solution: #1 store passwd files in a globbed array #2 create array reference from globbed array #3 open array ref, create hash with more than one value per key. Keys are regexps from filenames #4 read in every line of passwd files from reference. Values in hash need to be passwd entries For example: key => servernames.platform (dubhpr01.hpux) values => filelds from passwd file (name,uid,gid,comments) #5 Once hash is built, traverse through searching for usernames that have unlike UIDs from all files, then print these to an xls using SpreadSheet::WriteExcel. In my code I have completed 1,2 and 3. Started 4 but I am printing the array reference address as opposed to printing the actual values. What am I doing wrong and any tips would be nice? thank you _OUTPUT_ KEY dubhst14.hpux ELEMENTS/home/dbsmith/passwd.dubhst14.hpux DUB VALUES root KEY dubhdv05.hpux ELEMENTS/home/dbsmith/passwd.dubhdv05.hpux DUB VALUES root dubhst14.hpux => ARRAY(0x4002b0f8) dubhdv05.hpux => ARRAY(0x4059c9a4) dubhadm3.hpux => ARRAY(0x4059c8f0) dwhetls2.hpux => ARRAY(0x4002c164) dubhadm1.hpux => ARRAY(0x4059c8a8) oftappp1.hpux => ARRAY(0x405a2084) dubhpr28.hpux => ARRAY(0x4002e1bc) cic2.hpux => ARRAY(0x4059c6f8) #!/usr/bin/perl ##-- Initialize environment --## use strict; use warnings; use diagnostics; use Spreadsheet::WriteExcel; #use Data::Dumper; $ENV{"PATH"} = qq(/usr/bin:/bin:/home/dbsmith:/home/dbsmith/McGaw); delete @ENV{qw (IFS CDPATH ENV KSH_ENV BASH_ENV)}; ##-- Central DIE routine --## open (LOG, ">>/tmp/uid_ck.log") or warn "uid_ck.log did not open $!"; my $overide = $SIG{__DIE__};## get error handler currently assigned 2 die $SIG{__DIE__} = sub { my $error = shift; ## error now holds the mesg passed to die $overide->($error) if ( ref $overide ); print LOG ($error); }; ##-- BEGIN MAIN --## my @dublinaray = glob("/home/dbsmith/passwd.*"); my $dublin_aref = [EMAIL PROTECTED]; my @mcgawaray = glob("/home/dbsmith/McGaw/passwd.*"); my $mcgaw_aref = [EMAIL PROTECTED]; my (%dublin_hosts,%mcgaw_hosts) = (); my ($dub_key,$dub_values,$mcg_key,$mcg_values); parse_file(); sub parse_file { foreach my $element ( @{$dublin_aref} ) { { local *FILE; open (FILE, "+<$element") or die "dublin reference did not open: $!"; local $/ = undef; ($dub_key)= $element =~ m|\.(\w+\.\w+)\z|i; ($dub_values) = split /:/, ; push ( @{$dublin_hosts{$dub_key}}, $dub_values ); print "KEY\t",$dub_key,"\n\n"; print "ELEMENTS\t",$element,"\n\n"; print "DUB VALUES\t",$dub_values,"\n\n"; } } while ( ($dub_key,$dub_values) = each %dublin_hosts ) { print "$dub_key => $dub_values\n"; } #foreach my $host (sort keys %dublin_hosts) { #print "$host: @{$dublin_hosts{$dub_key}}\n"; #} #foreach my $element2 ( @{$mcgaw_aref} ) { # { local *FILE2; # open (FILE2, "+<$element2") or die "mcgaw reference did not open: $!"; # local $/ = undef; # ($mcg_key) = $element2 =~ m|\.(\w+\.\w+)\z|i; # push (@{$mcgaw_hosts{$mcg_key}}, $mcg_values ); # print "\n$element2\n\n"; # print ; # } #} } ##-- END SUB --## __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: reg exp continued need pulled from reference
oryann9 <[EMAIL PROTECTED]> wrote: "Dr.Ruud" wrote: Lawrence Statton XE2/N1GAK schreef: > @{$aref2}[0] is 'sun' ITYM: ${$aref2}[0] is 'sun' -- Affijn, Ruud "Gewoon is een tijger." -- Ok everyone, I have thought about this one and tried various code changes but cannot get what I want. My problem: redundant UIDs in password files. My solution: #1 store passwd files in a globbed array #2 create array reference from globbed array #3 open array ref, create hash with more than one value per key. Keys are regexps from filenames #4 read in every line of passwd files from reference. Values in hash need to be passwd entries For example: key => servernames.platform (dubhpr01.hpux) values => filelds from passwd file (name,uid,gid,comments) #5 Once hash is built, traverse through searching for usernames that have unlike UIDs from all files, then print these to an xls using SpreadSheet::WriteExcel. In my code I have completed 1,2 and 3. Started 4 but I am printing the array reference address as opposed to printing the actual values. What am I doing wrong and any tips would be nice? thank you _OUTPUT_ KEY dubhst14.hpux ELEMENTS /home/dbsmith/passwd.dubhst14.hpux DUB VALUES root KEY dubhdv05.hpux ELEMENTS /home/dbsmith/passwd.dubhdv05.hpux DUB VALUES root dubhst14.hpux => ARRAY(0x4002b0f8) dubhdv05.hpux => ARRAY(0x4059c9a4) dubhadm3.hpux => ARRAY(0x4059c8f0) dwhetls2.hpux => ARRAY(0x4002c164) dubhadm1.hpux => ARRAY(0x4059c8a8) oftappp1.hpux => ARRAY(0x405a2084) dubhpr28.hpux => ARRAY(0x4002e1bc) cic2.hpux => ARRAY(0x4059c6f8) #!/usr/bin/perl ##-- Initialize environment --## use strict; use warnings; use diagnostics; use Spreadsheet::WriteExcel; #use Data::Dumper; $ENV{"PATH"} = qq(/usr/bin:/bin:/home/dbsmith:/home/dbsmith/McGaw); delete @ENV{qw (IFS CDPATH ENV KSH_ENV BASH_ENV)}; ##-- Central DIE routine --## open (LOG, ">>/tmp/uid_ck.log") or warn "uid_ck.log did not open $!"; my $overide = $SIG{__DIE__}; ## get error handler currently assigned 2 die $SIG{__DIE__} = sub { my $error = shift; ## error now holds the mesg passed to die $overide->($error) if ( ref $overide ); print LOG ($error); }; ##-- BEGIN MAIN --## my @dublinaray = glob("/home/dbsmith/passwd.*"); my $dublin_aref = [EMAIL PROTECTED]; my @mcgawaray = glob("/home/dbsmith/McGaw/passwd.*"); my $mcgaw_aref = [EMAIL PROTECTED]; my (%dublin_hosts,%mcgaw_hosts) = (); my ($dub_key,$dub_values,$mcg_key,$mcg_values); parse_file(); sub parse_file { foreach my $element ( @{$dublin_aref} ) { { local *FILE; open (FILE, "+<$element") or die "dublin reference did not open: $!"; local $/ = undef; ($dub_key) = $element =~ m|\.(\w+\.\w+)\z|i; ($dub_values) = split /:/, ; push ( @{$dublin_hosts{$dub_key}}, $dub_values ); print "KEY\t",$dub_key,"\n\n"; print "ELEMENTS\t",$element,"\n\n"; print "DUB VALUES\t",$dub_values,"\n\n"; } } while ( ($dub_key,$dub_values) = each %dublin_hosts ) { print "$dub_key => $dub_values\n"; } #foreach my $host (sort keys %dublin_hosts) { # print "$host: @{$dublin_hosts{$dub_key}}\n"; #} #foreach my $element2 ( @{$mcgaw_aref} ) { # { local *FILE2; # open (FILE2, "+<$element2") or die "mcgaw reference did not open: $!"; # local $/ = undef; # ($mcg_key) = $element2 =~ m|\.(\w+\.\w+)\z|i; # push (@{$mcgaw_hosts{$mcg_key}}, $mcg_values ); # print "\n$element2\n\n"; # print ; # } #} } ##-- END SUB --## Incorrect problem statement. Should read My Problem: unalike UIDs in password files for users. example joe.brown uid on server a is 1222 and uid on server b is 1198. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: reg exp continued need pulled from reference
oryann9 <[EMAIL PROTECTED]> wrote:oryann9 <[EMAIL PROTECTED]> wrote: "Dr.Ruud" wrote: Lawrence Statton XE2/N1GAK schreef: > @{$aref2}[0] is 'sun' ITYM: ${$aref2}[0] is 'sun' -- Affijn, Ruud "Gewoon is een tijger." -- Ok everyone, I have thought about this one and tried various code changes but cannot get what I want. My problem: redundant UIDs in password files. My solution: #1 store passwd files in a globbed array #2 create array reference from globbed array #3 open array ref, create hash with more than one value per key. Keys are regexps from filenames #4 read in every line of passwd files from reference. Values in hash need to be passwd entries For example: key => servernames.platform (dubhpr01.hpux) values => filelds from passwd file (name,uid,gid,comments) #5 Once hash is built, traverse through searching for usernames that have unlike UIDs from all files, then print these to an xls using SpreadSheet::WriteExcel. In my code I have completed 1,2 and 3. Started 4 but I am printing the array reference address as opposed to printing the actual values. What am I doing wrong and any tips would be nice? thank you _OUTPUT_ KEY dubhst14.hpux ELEMENTS /home/dbsmith/passwd.dubhst14.hpux DUB VALUES root KEY dubhdv05.hpux ELEMENTS /home/dbsmith/passwd.dubhdv05.hpux DUB VALUES root dubhst14.hpux => ARRAY(0x4002b0f8) dubhdv05.hpux => ARRAY(0x4059c9a4) dubhadm3.hpux => ARRAY(0x4059c8f0) dwhetls2.hpux => ARRAY(0x4002c164) dubhadm1.hpux => ARRAY(0x4059c8a8) oftappp1.hpux => ARRAY(0x405a2084) dubhpr28.hpux => ARRAY(0x4002e1bc) cic2.hpux => ARRAY(0x4059c6f8) #!/usr/bin/perl ##-- Initialize environment --## use strict; use warnings; use diagnostics; use Spreadsheet::WriteExcel; #use Data::Dumper; $ENV{"PATH"} = qq(/usr/bin:/bin:/home/dbsmith:/home/dbsmith/McGaw); delete @ENV{qw (IFS CDPATH ENV KSH_ENV BASH_ENV)}; ##-- Central DIE routine --## open (LOG, ">>/tmp/uid_ck.log") or warn "uid_ck.log did not open $!"; my $overide = $SIG{__DIE__}; ## get error handler currently assigned 2 die $SIG{__DIE__} = sub { my $error = shift; ## error now holds the mesg passed to die $overide->($error) if ( ref $overide ); print LOG ($error); }; ##-- BEGIN MAIN --## my @dublinaray = glob("/home/dbsmith/passwd.*"); my $dublin_aref = [EMAIL PROTECTED]; my @mcgawaray = glob("/home/dbsmith/McGaw/passwd.*"); my $mcgaw_aref = [EMAIL PROTECTED]; my (%dublin_hosts,%mcgaw_hosts) = (); my ($dub_key,$dub_values,$mcg_key,$mcg_values); parse_file(); sub parse_file { foreach my $element ( @{$dublin_aref} ) { { local *FILE; open (FILE, "+<$element") or die "dublin reference did not open: $!"; local $/ = undef; ($dub_key) = $element =~ m|\.(\w+\.\w+)\z|i; ($dub_values) = split /:/, ; push ( @{$dublin_hosts{$dub_key}}, $dub_values ); print "KEY\t",$dub_key,"\n\n"; print "ELEMENTS\t",$element,"\n\n"; print "DUB VALUES\t",$dub_values,"\n\n"; } } while ( ($dub_key,$dub_values) = each %dublin_hosts ) { print "$dub_key => $dub_values\n"; } #foreach my $host (sort keys %dublin_hosts) { # print "$host: @{$dublin_hosts{$dub_key}}\n"; #} #foreach my $element2 ( @{$mcgaw_aref} ) { # { local *FILE2; # open (FILE2, "+<$element2") or die "mcgaw reference did not open: $!"; # local $/ = undef; # ($mcg_key) = $element2 =~ m|\.(\w+\.\w+)\z|i; # push (@{$mcgaw_hosts{$mcg_key}}, $mcg_values ); # print "\n$element2\n\n"; # print ; # } #} } ##-- END SUB --## Incorrect problem statement. Should read My Problem: unalike UIDs in password files for users. example joe.brown uid on server a is 1222 and uid on server b is 1198. __ I looked in the cookbook and as I tried to implement is below. Am I on the right road? 5.7. Hashes with Multiple Values Per KeyProblem You want to store more than one value for each key. Solution Store an array reference in $hash{$key}, and put the values into that array. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
reg exp continued need pulled from reference
Hello... I have thought about this one and tried various code changes but cannot get what I want. My problem: mismatched UIDs in password files. My solution: #1 store passwd files in a globbed array #2 create array reference from globbed array #3 open array ref, create hash with more than one value per key. Keys are regexps from filenames #4 read in every line of passwd files from reference. Values in hash need to be passwd entries For example: key => servernames.platform (dubhpr01.hpux) values => filelds from passwd file (name,uid,gid,comments) #5 Once hash is built, traverse through searching for usernames that have unlike UIDs from all files, then print these to an xls using SpreadSheet::WriteExcel. In my code I have completed 1,2 and 3. Started 4 but I am printing the array reference address as opposed to printing the actual values. What am I doing wrong and any tips would be nice? _OUTPUT_ KEY dubhst14.hpux ELEMENTS /home/dbsmith/passwd.dubhst14.hpux DUB VALUES root KEY dubhdv05.hpux ELEMENTS /home/dbsmith/passwd.dubhdv05.hpux DUB VALUES root dubhst14.hpux => ARRAY(0x4002b0f8) dubhdv05.hpux => ARRAY(0x4059c9a4) dubhadm3.hpux => ARRAY(0x4059c8f0) dwhetls2.hpux => ARRAY(0x4002c164) dubhadm1.hpux => ARRAY(0x4059c8a8) oftappp1.hpux => ARRAY(0x405a2084) dubhpr28.hpux => ARRAY(0x4002e1bc) cic2.hpux => ARRAY(0x4059c6f8) #!/usr/bin/perl ##-- Initialize environment --## use strict; use warnings; use diagnostics; use Spreadsheet::WriteExcel; #use Data::Dumper; $ENV{"PATH"} = qq(/usr/bin:/bin:/home/dbsmith:/home/dbsmith/McGaw); delete @ENV{qw (IFS CDPATH ENV KSH_ENV BASH_ENV)}; ##-- Central DIE routine --## open (LOG, ">>/tmp/uid_ck.log") or warn "uid_ck.log did not open $!"; my $overide = $SIG{__DIE__}; ## get error handler currently assigned 2 die $SIG{__DIE__} = sub { my $error = shift; ## error now holds the mesg passed to die $overide->($error) if ( ref $overide ); print LOG ($error); }; ##-- BEGIN MAIN --## my @dublinaray = glob("/home/dbsmith/passwd.*"); my $dublin_aref = [EMAIL PROTECTED]; my @mcgawaray = glob("/home/dbsmith/McGaw/passwd.*"); my $mcgaw_aref = [EMAIL PROTECTED]; my (%dublin_hosts,%mcgaw_hosts) = (); my ($dub_key,$dub_values,$mcg_key,$mcg_values); parse_file(); sub parse_file { foreach my $element ( @{$dublin_aref} ) { { local *FILE; open (FILE, "+<$element") or die "dublin reference did not open: $!"; local $/ = undef; ($dub_key) = $element =~ m|\.(\w+\.\w+)\z|i; ($dub_values) = split /:/, ; push ( @{$dublin_hosts{$dub_key}}, $dub_values ); print "KEY\t",$dub_key,"\n\n"; print "ELEMENTS\t",$element,"\n\n"; print "DUB VALUES\t",$dub_values,"\n\n"; } } while ( ($dub_key,$dub_values) = each %dublin_hosts ) { print "$dub_key => $dub_values\n"; } #foreach my $host (sort keys %dublin_hosts) { #print "$host: @{$dublin_hosts{$dub_key}}\n"; #} #foreach my $element2 ( @{$mcgaw_aref} ) { # { local *FILE2; # open (FILE2, "+<$element2") or die "mcgaw reference did not open: $!"; # local $/ = undef; # ($mcg_key) = $element2 =~ m|\.(\w+\.\w+)\z|i; # push (@{$mcgaw_hosts{$mcg_key}}, $mcg_values ); # print "\n$element2\n\n"; # print ; # } #} } ##-- END SUB --## __ I looked in the cookbook and as I tried to implement is below. Am I on the right road? thank you 5.7. Hashes with Multiple Values Per KeyProblem You want to store more than one value for each key. Solution Store an array reference in $hash{$key}, and put the values into that array. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: reg exp continued need pulled from reference
"D. Bolliger" <[EMAIL PROTECTED]> wrote: I guess the reason why you got no answer when you posted the identical question in a recent thread is because, at least - your question(s) is/are unclear - your code is not trimmed - even not from comments Anyway. When you print $dub_values and it shows up as an array ref as ARRAY(0x4002c164) and you want the values of this arrayref, you have to dereference it in some way. Start with printing out @$dub_values. Or assign it before if you want bigger freedom to format the values: my @[EMAIL PROTECTED]; # handle @dub_values_arr Hope this helps Dani How are my quesitons unclear??? Man I take a beating from this help list. I have seen many questions asked that are just "bone-headed" questions or people are too lazy to research and I do not feel my questions fall in these categories. I stated " I am printing the array reference address as opposed to printing the actual values. What am I doing wrong and any tips would be nice?" How is that unclear? __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: reg exp continued need pulled from reference
"D. Bolliger" <[EMAIL PROTECTED]> wrote:oryann9 am Montag, 18. Dezember 2006 19:52: > "D. Bolliger" wrote: [snipped] > How are my quesitons unclear??? [snipped] I answered offlist. Sorry to all for the noise of this notice. Dani thank god! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: reg exp continued need pulled from reference
Anyway. When you print $dub_values and it shows up as an array ref as ARRAY(0x4002c164) and you want the values of this arrayref, you have to dereference it in some way. Start with printing out @$dub_values. Or assign it before if you want bigger freedom to format the values: my @[EMAIL PROTECTED]; # handle @dub_values_arr Hope this helps Dani I don't mean to sound negative, but did you even look at my code? I know how to dereference and I was just printing this in my debugging efforts. dublin_aref = [EMAIL PROTECTED] Again, @dublin_arry contains a glob like so: glob("/home/oryann9/passwd.*) dub_values are the values within the hash %dublin_hosts while dub_key is the regexp from the filenames that is the key within the hash %dublin_hosts. As an example, each key is the regexp of each file name from the array reference: passwd.dubhpr01.hpux after being parsed by my regexp I get dubhpr01.hpux Each values are the various fields in the passwd files. My Goal is below key=>dubhpr01.hpux values=>name,uid,gid,comments Here is the snippet of code I am working on now: 1 use strict; 2 use warning; 3 use diagnostics; 4 5 my @dublinaray = glob("/home/oryann9/passwd.*"); 6 my $dublin_aref = [EMAIL PROTECTED]; 7 my (%dublin_hosts) = (); 8 my ($dub_key,$dub_values,); 9 10 parse_file(); 11 12 13 sub parse_file { 14 foreach my $element ( @{$dublin_aref} ) { 15 { local *FILE; 16 open (FILE, "+<$element") or die "dublin reference did not open: $!"; 17 local $/ = undef; 18($dub_key)= $element =~ m|\.(\w+\.\w+)\z|i; 19 ($dub_values) = split /:/, ; 20push ( @{$dublin_hosts{$dub_key}}, $dub_values ); 21print Dumper("KEY\t",$dub_key,"\n\n"); 22print Dumper("ELEMENTS\t",$element,"\n\n"); 23print Dumper("DUB VALUES\t",$dub_values,"\n\n"); 24 } 25} 26while ( ($dub_key,$dub_values) = each %dublin_hosts ) { 27print Dumper("$dub_key => $dub_values\n"); 28} 29 30 } ##-- END SUB --## Here is my question I have a line of code like so: "$dub_key => $dub_values\n"; that prints dubhpr28.hpux => ARRAY(0x4002e1bc) but I want to have printed out the values contained in the $dub_values arrayref instead of its address. What do I have to change to achieve this? thank you __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: reg exp continued need pulled from reference
oryann9 <[EMAIL PROTECTED]> wrote: Here is my question I have a line of code like so: "$dub_key => $dub_values\n"; that prints dubhpr28.hpux => ARRAY(0x4002e1bc) but I want to have printed out the values contained in the $dub_values arrayref instead of its address. What do I have to change to achieve this? thank you I got it working...never mind. I shall be back... : ) thank you __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
pdf to excel
I have a scanned PDF file and I want to convert its data so I can store it in an xls file. What module(s) do you recommened? I saw File::Extract::PDF ?? __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
KSH and Perl output
I am trying to get the equivalent in KSH to work in Perl and I cannot seem to get the same output. I need from /etc/passwd name, uid, gid and gecos for each passwd files. IN KSH: for i in `ls /var/tmp/passwd.*` do print $i; print "\n"; awk 'FS=":" {print $1,"\t",$3,"\t",$4,"\t",$5}' $i; print "\n"; done IN PERL use strict; use warnings; my @array = glob("/var/tmp/passwd.*"); my ($file,@name,@uid,@gid,@cmts); foreach $file (@array) { { local $/ = undef; open (FILE, "+<$file") or die $!; (@name,@uid,@gid,@cmts) = (split /:/, ) [0,2,3,4],"\n"; print ("@name\n"); print ("@uid\n"); print ("@gid\n"); print ("@cmts\n"); } } Perl Output: root 0 3 root 0 3 NS2 Root root 0 3 tpgdrpp1 Root ... Desired and KSH output : /var/tmp/passwd.admbakp1.hpux root 0 3 daemon 1 5 bin 2 2 sys 3 3 adm 4 4 uucp 5 3 lp 9 7 nuucp11 11 hpdb 27 1 ALLBASE nobody -2 -2 www 30 1 webadmin 40 1 smbnull 101 101 DO NOT USE OR DELETE - needed by Samba jgardner 142020 xxx jchow151620 xxx jwang151220 x ctegarde 176020 xxx sshd 102 102 sshd privsep rcollins 164020 x dstephen 151520 veritas 635220 veritas support account kurathb 103 2017xx baccelb 20082017x krahnd 224 2017x gladant 510 2017x tyleryo 194820 nguyenhe 192920 xx patelru 194920 camposi 195020 brandom 193020 xx panti194520 xxx dwilkins 20372017xxx hpase163920 HP Support rdittmer 21682017xx baxadmin 50000 gonzalea 219620 /var/tmp/passwd.admsrcp1.hpux . . . thank you derek __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: pdf to excel
Daniel Kasak <[EMAIL PROTECTED]> wrote:oryann9 wrote: > I have a scanned PDF file and I want to convert its data so I can store it in > an xls file. What module(s) do you recommened? > > I saw File::Extract::PDF ? If you've scanned it, chances are the PDF doesn't contain any text that you can extract. It will just be 1 image per page. You have to do OCR on it ... and possibly convert the PDF into TIFF of jpeg images or something first. There are a number of open-source OCR engines around, including one that IBM bought and open-sourced. I haven't look at any of them in years though, so I don't know what state they're in. Dan ... Mmm interesting. No I have not scanned it yet. Actually it's my wife's X-mas address book that needs re-written so I was thinking of scanning it then editing it then re-printing it and finally savintg it to an xls file. Or was considering PDF::Labels Routines to produce formatted pages of mailing labels in PDF thx for the info! ...was not aware of that. derek __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: KSH and Perl output
Boga Srinivas <[EMAIL PROTECTED]> wrote:oryann9 wrote: > I am trying to get the equivalent in KSH to work in Perl and I cannot seem to > get the same output. I need from /etc/passwd name, uid, gid and gecos for > each passwd files. > > IN KSH: > > for i in `ls /var/tmp/passwd.*` > do > print $i; > print "\n"; > awk 'FS=":" {print $1,"\t",$3,"\t",$4,"\t",$5}' $i; > print "\n"; > done > > IN PERL > > use strict; > use warnings; > > my @array = glob("/var/tmp/passwd.*"); > my ($file,@name,@uid,@gid,@cmts); > foreach $file (@array) { > { local $/ = undef; > open (FILE, "+<$file") or die $!; > (@name,@uid,@gid,@cmts) = (split /:/, ) [0,2,3,4],"\n"; > print ("@name\n"); > print ("@uid\n"); > print ("@gid\n"); > print ("@cmts\n"); > } > } > > Perl Output: > root 0 3 > root 0 3 NS2 Root > root 0 3 tpgdrpp1 Root > ... > > > Desired and KSH output : > > /var/tmp/passwd.admbakp1.hpux > > root 0 3 > daemon 1 5 > bin 2 2 > sys 3 3 > adm 4 4 > uucp 5 3 > lp 9 7 > nuucp 11 11 > hpdb 27 1 ALLBASE > > Try this, #!/usr/bin/perl open( PASSWD, "/etc/passwd" ); while( ) { chomp; @arr = split (/:/); @[EMAIL PROTECTED],2,3,4]; print "\n @res"; } -- Boga Srinivas System Engineer cool, thanks! I modified it so it will work on multiple files. use strict; use warnings; my @glob = glob("/cygdrive/c/temp/passwd.*"); my (@arr,@res,$file) = (); foreach $file (@glob) { open (FILE, "+<$file") or die "file: '$file' did not open $!"; { local $/ = undef; my $contents = ; chomp $contents; @arr = split (/:/, $contents); @[EMAIL PROTECTED],2,3,4]; print "\n @res"; } } print "\n"; close (FILE); derek __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
HoHoH
I have a HoHoH structure that looks like after running print Dumper (\%hash); 'prlhNSSA' => { '1499' => { 'gecos' => 'First Name Last Name,CIS,location, 'host' => '/var/tmp/passwd.tgpdrpp1.hpux', 'gid' => '205' } } }; My 1st hash is keyed by name, that accesses 2nd hash keyed by UID, that accesses a 3rd hash keyed by remaining items: gid,gecos and hostname. The snippet of code is: my %hash; my ($name, $uid, $gid, $gecos); my $regexp= qr/(\w+|\w+\.\w+|\w+\-\w+|\w+\_\w+)\s+(\d+)\s+(\d+)\s+(.*)/i ; ... ... elsif (/$regexp/) { ($name, $uid, $gid, $gecos) = ($1, $2, $3, $4); $hash{$name}{$uid} = { # User data keyed by uid gid => $gid, gecos => $gecos, host=> $host, my question is how do I access and print all values? I am trying: foreach (keys %dub_hash) { print %{$dub_hash->{$name}->{$uid}->{%gid}->{$gecos} }; } Do I need three loops? What am I doing wrong? thank you __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: HoHoH
> my question is how do I access and print all values? I am trying: > > foreach (keys %dub_hash) { > print %{$dub_hash->{$name}->{$uid}->{%gid}->{$gecos} }; > } > > Do I need three loops? What am I doing wrong? Yup, three loops. I'll get you started: for my $name (keys %dub_hash) { for my $uid (keys %{$dub_hash{$name}}) { # do stuff, note the %{...} above to force precedence } } Ok thank you! So if I have a HoHoHoH I would need 4 loops and so on? Is there a good tutorial for hashes with real world examples b/c I seem to struggle with comples data structures as the above took me longer than expected. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: remove duplicate lines
"Dr.Ruud" <[EMAIL PROTECTED]> wrote: beast schreef: > a 100 > a 102 > c 100 > a 102 > b 111 > c 100 > c 102 > c 100 > c 100 > a 102 > ... > > I would like to have a list (either array or hash) with unique line . perl -ne'$_{$_}||=print' datafile or perl -pe'$_ x=!$$_++' datafile -- Affijn, Ruud what are these exactly doing in plain english? 1st line is not printing and second it is, but gets confusing at ||= in the 1st line and at !$ in 2nd line. thank you __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
HoH and HoHoH
HoH 'jblow' => { 'uid' => '2195', 'gecos' => 'Joe Blow,,,', 'gid' => '20' }, snippet. ( $name, $p, $uid, $gid, $gecos, $dir, $s ) = split( ':' ); $hash1{$name} -> {'uid'} = $uid; $hash1{$name} -> {'gid'} = $gid; $hash1{$name} -> {'gecos'} = $gecos; HoHoH -- $VAR1 = { 'jblow' => { '2195' => { 'gecos' => 'Joe Blow,,,', 'gid' => '20' } } }; snippet.. $hash2{$name}{$uid} = { gid => $gid, gecos => $gecos, }; so that I grasp hashes and understand them more, in the first printed dump of HoH, there are 2 hashes called "hash1 and "name". Hash hash1 has a key of name with values of uid,gid and gecos? uid,gid and gecos are accessed only through name? in the printed dump of HoHoH, there are 3 hashes called "hash2", "name" and "uid". Hash hash2 has keys of name and uid with values of gid and gecos? gid and gecos are only accessible through hash uid? thank you - Want to start your own business? Learn how on Yahoo! Small Business.
HoH and HoHoH
HoH 'jblow' => { 'uid' => '2195', 'gecos' => 'Joe Blow,,,', 'gid' => '20' }, snippet. ( $name, $p, $uid, $gid, $gecos, $dir, $s ) = split( ':' ); $hash1{$name} -> {'uid'} = $uid; $hash1{$name} -> {'gid'} = $gid; $hash1{$name} -> {'gecos'} = $gecos; HoHoH -- $VAR1 = { 'jblow' => { '2195' => { 'gecos' => 'Joe Blow,,,', 'gid' => '20' } } }; snippet.. $hash2{$name}{$uid} = { gid => $gid, gecos => $gecos, }; so that I grasp hashes and understand them more, in the first printed dump of HoH, there are 2 hashes called "hash1 and "name". Hash hash1 has a key of name with values of uid,gid and gecos? uid,gid and gecos are accessed only through name? in the printed dump of HoHoH, there are 3 hashes called "hash2", "name" and "uid". Hash hash2 has keys of name and uid with values of gid and gecos? gid and gecos are only accessible through hash uid? thank you __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: remove duplicate lines
"Dr.Ruud" <[EMAIL PROTECTED]> wrote:oryann9 schreef: > "Dr.Ruud" wrote: beast schreef: >> beast: >>> a 100 >>> a 102 >>> c 100 >>> a 102 >>> b 111 >>> c 100 >>> c 102 >>> c 100 >>> c 100 >>> a 102 >>> ... >>> >>> I would like to have a list (either array or hash) with unique line . >> >> perl -ne'$_{$_}||=print' datafile > > what are these exactly doing in plain english? > 1st line is not printing and second it is, but gets confusing at ||= in the 1st line and at !$ in 2nd line First see the output of perl -MO=Deparse -ne'$_{$_}||=print' datafile which returns: LINE: while (defined($_ = )) { $_{$_} ||= print($_); } See `perldoc perlrun` for the meaning of the -n option. Let me simplify the code, to this equivalent: while ( ) { $d{$_} ||= print($_); } For every unique line of the input (the datafile) an entry to the hash-table %d is added, with the whole line as the key-value. The belonging value is set to the return value of print, which is 1 (if the print went OK). But if the key already exists, this is all skipped, because of the ||= operator, see `perldoc perlop`. This operator sets the lvalue to the rvalue, but only if the lvalue isn't true. So the loop is similar to while ( ) { next if $d{$_}; print; $d{$_} = 1; } And that was my explanation of perl -ne'$_{$_}||=print'. -- Affijn, Ruud cool! thanks, now I understand. - Want to start your own business? Learn how on Yahoo! Small Business.
HoH and HoHoH
HoH 'jblow' => { 'uid' => '2195', 'gecos' => 'Joe Blow,,,', 'gid' => '20' }, snippet. ( $name, $p, $uid, $gid, $gecos, $dir, $s ) = split( ':' ); $hash1{$name} -> {'uid'} = $uid; $hash1{$name} -> {'gid'} = $gid; $hash1{$name} -> {'gecos'} = $gecos; HoHoH -- $VAR1 = { 'jblow' => { '2195' => { 'gecos' => 'Joe Blow,,,', 'gid' => '20' } } }; snippet.. $hash2{$name}{$uid} = { gid => $gid, gecos => $gecos, }; so that I grasp hashes and understand them more, in the first printed dump of HoH, there are 2 hashes called "hash1 and "name". Hash hash1 has a key of name with values of uid,gid and gecos? uid,gid and gecos are accessed only through name? in the printed dump of HoHoH, there are 3 hashes called "hash2", "name" and "uid". Hash hash2 has keys of name and uid with values of gid and gecos? gid and gecos are only accessible through hash uid? please provide any corrections. thank you - Don't pick lemons. See all the new 2007 cars at Yahoo! Autos.
port blocking on a wintel box
Is there a way to block certain ports using Perl? If so please send me snippet sample code and or recommend module name to get me started. thank you - Finding fabulous fares is fun. Let Yahoo! FareChase search your favorite travel sites to find flight and hotel bargains.
regexp
In this regexp my $regexp = qr/(\d+\x3a1108 |\w+\x3a1108{1,} ) /; vs. my $regexp1 = qr/(\d+\x3a1108 |\w+\x3a1108){1,} /; does the {1,} construct outside the parens () mean the entire string 1 or more times and within the parens mean only the last string \x3s1180 1 or more times? What is the diff? thank you. - Don't pick lemons. See all the new 2007 cars at Yahoo! Autos.
Re: regexp
"John W. Krahn" <[EMAIL PROTECTED]> wrote:oryann9 wrote: > In this regexp > > my $regexp = qr/(\d+\x3a1108 > |\w+\x3a1108{1,} ) /; > > vs. > > my $regexp1 = qr/(\d+\x3a1108 > |\w+\x3a1108){1,} /; > > does the {1,} construct outside the parens () mean the entire string 1 > or more times and within the parens mean only the last string \x3s1180 > 1 or more times? > > What is the diff? Modifiers affect the preceding character or grouping so in the first example the modifier is attached to the character '8' and in the second example the modifier is attached to the parentheses which will affect the entire contents of the enclosing parentheses. Also note that \d is a subset of \w so anything that matches \w will also match \d. John -- ok did not know the subset info. thx agn! - Looking for earth-friendly autos? Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
regexp... weird results
Hello Perl list, I need to grab from an intel machine all lines with :5101 from netstat -a. If I dont group the regexp using parens then it prints all the needed lines. If I group the regexp using parens then it does not print all the needed lines. Any help and an explanation...I am confused now. thank you my $regexp = qr/.*\x3a5101.*/; open (NS, "$ns -|") or die "system call netstat '$ns' failed: $!"; print "Looking for 3191\t1026\t5051\t5101\n\n"; while () { next if m|local\w+\x3a\d+|i; if (/$regexp/) { print $_; } } OR while () { next if m|local\w+\x3a\d+|i; if (m|(.*\x3a5101.*)|g) { print ($1); } } - Sucker-punch spam with award-winning protection. Try the free Yahoo! Mail Beta.
Re: regexp... weird results
oryann9 <[EMAIL PROTECTED]> wrote:Hello Perl list, I need to grab from an intel machine all lines with :5101 from netstat -a. If I dont group the regexp using parens then it prints all the needed lines. If I group the regexp using parens then it does not print all the needed lines. Any help and an explanation...I am confused now. thank you my $regexp = qr/.*\x3a5101.*/; open (NS, "$ns -|") or die "system call netstat '$ns' failed: $!"; print "Looking for 3191\t1026\t5051\t5101\n\n"; while () { next if m|local\w+\x3a\d+|i; if (/$regexp/) { print $_; } } OR while () { next if m|local\w+\x3a\d+|i; if (m|(.*\x3a5101.*)|g) { print ($1); } } *** I was able to figure it out. The solution was /s. my $regexp = qr/.*\x3a5101.*/s; However, when I put multiple port numbers in the regexp it does NOT work. I want to store them in memory for later use which is why I am using 1,2,3,4... my $regexp = qr/(.*\x3a5101.*)(.*\x3a5051.*)(.*\x3a3191.*)(.*\x3a1026.*)/s; any help please? - Everyone is raving about the all-new Yahoo! Mail beta.
Re: regexp... weird results
Jay Savage <[EMAIL PROTECTED]> wrote:On 2/1/07, oryann9 wrote: > oryann9 wrote: Hello Perl list, > [snip] > > I was able to figure it out. The solution was /s. > my $regexp = qr/.*\x3a5101.*/s; > > However, when I put multiple port numbers in the regexp it does NOT work. > I want to store them in memory for later use which is why I am using > 1,2,3,4... > my $regexp = qr/(.*\x3a5101.*)(.*\x3a5051.*)(.*\x3a3191.*)(.*\x3a1026.*)/s; Take another look at perlre and perlretut. That says, roughly: You haven't included an "or" method anywhere; in order for a string to match your pattern, it has to contain all four complete elements. Also, why '\x3a' instead of ':'? and finally, if you're looking anywhere in the string, you don't need '.*' on both sides of the expression. You're probably looking for something like /:5101|:5051|:3191|:1026/ # or to capture the port number: /:(5101|5051|3191|1026)/ perlre has the details on '|'. HTH, ** Jay, thanks for the reply. I am aware of the bit | operator and I tried using that prior to posting this message, but was having issues then. I will try again. - Access over 1 million songs - Yahoo! Music Unlimited.
using ssmtp to send mail from Intel cygwin platform
Hello...: ) I am having issues sending mail from within a perl script on an intel using the cygwin platform; the code is simply not sending email. CYGWIN_NT-5.1 laptop 1.5.23(0.156/4/2) 2006-12-19 10:52 i686 Cygwin snippet... qx(/usr/sbin/ssmtp $user < $log); system("/usr/sbin/ssmtp $user < $log") or warn "email did not send $!"; 'ssmtp $user < $log`; I then tried to just type in the email recipient and file w/out using variables and this did not work. I did verify the log and user variables were being parsed correctly via print "[$user]\t"[$log]"; I have tried using qx, system, ` ` and require calling a file that has the ssmtp command in it to no success. I receive no warnings or errors. I then tried using MIME::Lite and it does not send and no errors or warnings. However, the command alone from my cygwin prompt does send mail after configuring ssmtp via /usr/bin/ssmtp-config. ssmtp [EMAIL PROTECTED] < /cygdrive/c/temp/test.txt Does anyone know what it could be or know of any known issues with this action of having Perl send mail using ssmtp on an cygwin platform? thank you - Any questions? Get answers on any topic at Yahoo! Answers. Try it now.
cgi calander
Any hints or pointers would be appreciated! thank you When the dates change my calendar gets thrown off. The daynames and dates are not matching up. I tested this by simply adding and subtracting 1 from the SQL call curdate() +1 or curdate() -1. Shouldn't I be able to manipulate the @weeks_anonymous array using the SQL call select dayofweek(curdate()); rather than using hardcoded undef's? Here is my code: #!/usr/bin/perl use strict; use warnings; require "dbi-lib.pl"; use CGI qw/:standard *table start_ul/, (-unique_headers); use CGI::Carp qw(fatalsToBrowser); use DBI; my $cgi = new CGI; local $sth; #--# # Function calls # #--# print_header(); initialize_dbi(); ## # Begin Main # ## print $cgi->header(), $cgi->start_html ('SQL Lesson11'), $cgi->h1 ({-style=>'Color:blue'},'SQL Class'); print "",$cgi->strong('Date/Time CGI Table:'),""; print $cgi->caption('MySQL calendar table output, Lesson 11:'); print ""; run_statement( "select date_format(curdate(), '%b %e, %Y');" ); my $today = $sth->fetchrow; run_statement("select dayofweek(curdate() );" ); my $dayofweek = $sth->fetchrow; print $dayofweek; #&run_statement( "select date_format(curdate()-2,'%W');" ); #my $twodayago = $sth->fetchrow; #print "$twodayago "; my @WeekDays = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday); my ($day,$week,) = (0,0); my (@weeks, @weeks_anonymous,) = ((),()); foreach $day ('-15' .. '15') { run_statement( "select date_format(date_add(curdate(), interval '$day' day), '%b %e, %Y');" ); push (@weeks, $sth->fetchrow); } ## Begin Table ## print table({border=>undef}); print Tr ({-align=>'CENTER',-valign=>'TOP'}, td ([EMAIL PROTECTED])); @weeks_anonymous = ( [ undef, undef, $weeks[0], $weeks[1], $weeks[2], $weeks[3] ], [ $weeks[4], $weeks[5], $weeks[6], $weeks[7], $weeks[8], $weeks[9], $weeks[10] ], [ $weeks[11], $weeks[12], $weeks[13], $weeks[14], $weeks[15], $weeks[16], $weeks[17] ], [ $weeks[18], $weeks[19], $weeks[20], $weeks[21], $weeks[22], $weeks[23], $weeks[24] ], [ $weeks[25], $weeks[26], $weeks[27], $weeks[28], $weeks[29], $weeks[30], $weeks[31] ], ); foreach $element (@weeks_anonymous) { print Tr({-align=>'CENTER',-valign=>'TOP'}); for $date (@{$element}) { if (! defined $date) { print td (''); } elsif ($date eq $today) { print td(strong($date)); } else { print td ($date); } } print $cgi->end_Tr; } print $cgi->end_html; Be a PS3 game guru. Get your game face on with the latest PS3 news and previews at Yahoo! Games. http://videogames.yahoo.com/platform?platform=120121 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
cgi calender
All, I am having an issue getting my cgi calender to print correctly. Any help or hints would be appreciated! I was thinking of manipulating the @weeks_anonymous array with select dayofweek(curdate()) rather than using hardcoed undef's Problem: cgi calender daynames are not matching up with dates. For example: Todays date 02/27/2007 is being printed under Thursday instead of Tuesday. Sun Mon Tues Wed Thurs Fri Sat Feb 12, 07 Feb 13, 07 Feb 14, 07 Feb 15, 07 Feb 16, 2007 Feb 17, 2007 Feb 18, 2007 Feb 19, 2007 Feb 20, 2007 Feb 21, 2007 Feb 22, 2007 Feb 23, 2007 Feb 24, 2007 Feb 25, 2007 Feb 26, 2007 Feb 27, 2007 Feb 28, 2007 Mar 1, 2007 Mar 2, 2007 Mar 3, 2007 Mar 4, 2007 Mar 5, 2007 Mar 6, 2007 Mar 7, 2007 Mar 8, 2007 Mar 9, 2007 Mar 10, 2007 Mar 11, 2007 Mar 12, 2007 Mar 13, 2007 Mar 14, 2007 wherein today the 27th lines up with Thursday when executing this code. I need it to correctly line up with Tuesday. Finally, I am unable to use HTML::Calander modules so this is not an option. #!/usr/bin/perl use strict; use warnings; require "dbi-lib.pl"; use CGI qw/:standard *table start_ul/, (-unique_headers); use CGI::Carp qw(fatalsToBrowser); use DBI; my $cgi = new CGI; local $sth; #--# # Function calls # #--# print_header(); initialize_dbi(); ## # Begin Main # ## print $cgi->header(), $cgi->start_html ('Oreilly SQL Class, Lesson 11'), # Header $cgi->h1 ({-style=>'Color:blue'},'Derek\'s SQL Class'); # Body print "",$cgi->strong('Date/Time CGI Table:'),""; print $cgi->caption('MySQL calendar table output, Lesson 11:'); print ""; run_statement( "select date_format(curdate(), '%b %e, %Y');" ); my $today = $sth->fetchrow; run_statement("select dayofweek(curdate() );" ); my $dayofweek = $sth->fetchrow; print $dayofweek; #&run_statement( "select date_format(curdate()-2,'%W');" ); #my $twodayago = $sth->fetchrow; #print "$twodayago "; my @WeekDays = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday); my ($day,$week,) = (0,0); my (@weeks, @weeks_anonymous,) = ((),()); foreach $day ('-15' .. '15') { run_statement( "select date_format(date_add(curdate(), interval '$day' day), '%b %e, %Y');" ); push (@weeks, $sth->fetchrow); } ## Begin Table ## print table({border=>undef}); print Tr ({-align=>'CENTER',-valign=>'TOP'}, td ([EMAIL PROTECTED])); @weeks_anonymous = ( [undef, undef, $weeks[0], $weeks[1], $weeks[2], $weeks[3] ], [$weeks[4], $weeks[5], $weeks[6], $weeks[7], $weeks[8], $weeks[9], $weeks[10] ], [$weeks[11], $weeks[12], $weeks[13], $weeks[14], $weeks[15], $weeks[16], $weeks[17] ], [$weeks[18], $weeks[19], $weeks[20], $weeks[21], $weeks[22], $weeks[23], $weeks[24] ], [$weeks[25], $weeks[26], $weeks[27], $weeks[28], $weeks[29], $weeks[30], $weeks[31] ], ); foreach $element (@weeks_anonymous) { print Tr({-align=>'CENTER',-valign=>'TOP'}); for $date (@{$element}) { if (! defined $date) { print td (''); } elsif ($date eq $today) { print td(strong($date)); } else { print td ($date); } } print $cgi->end_Tr; } print $cgi->end_html; The fish are biting. Get more visitors on your site using Yahoo! Search Marketing. http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: cgi calender
--- oryann9 <[EMAIL PROTECTED]> wrote: > All, > > I am having an issue getting my cgi calender to > print > correctly. Any help or hints would be appreciated! > I was thinking of manipulating the @weeks_anonymous > array with select dayofweek(curdate()) rather than > using hardcoed undef's > > Problem: cgi calender daynames are not matching up > with dates. For example: Todays date 02/27/2007 is > being printed under Thursday instead of Tuesday. > > Sun Mon Tues Wed Thurs Fri Sat > Feb 12, 07 Feb 13, 07 Feb 14, 07 Feb 15, 07 > Feb 16, 2007 Feb 17, 2007 Feb 18, 2007 Feb 19, 2007 > Feb 20, 2007 Feb 21, 2007 Feb 22, 2007 > Feb 23, 2007 Feb 24, 2007 Feb 25, 2007 Feb 26, 2007 > Feb 27, 2007 Feb 28, 2007 Mar 1, 2007 > Mar 2, 2007 Mar 3, 2007 Mar 4, 2007 Mar 5, 2007 Mar > 6, > 2007 Mar 7, 2007 Mar 8, 2007 > Mar 9, 2007 Mar 10, 2007 Mar 11, 2007 Mar 12, 2007 > Mar > 13, 2007 Mar 14, 2007 > > wherein today the 27th lines up with Thursday when > executing this code. I need it to correctly line up > with Tuesday. Finally, I am unable to use > HTML::Calander modules so this is not an option. > I added some code to address this issue, a hash and an array to store dayofweek numbers, but still trying to figure out how to merge these two code additions to solve the dates with dayname problem. #!/usr/bin/perl use strict; use warnings; require "dbi-lib.pl"; use CGI qw/:standard *table start_ul/, (-unique_headers); use CGI::Carp qw(fatalsToBrowser); use DBI; my $cgi = new CGI; local $sth; #--# # Function calls # #--# print_header(); initialize_dbi(); ## # Begin Main # ## print $cgi->header(), $cgi->start_html ('Lesson 11'), $cgi->h1 ({-style=>'Color:blue'},'SQL Class'); print "",$cgi->strong('Date/Time CGI Table:'),""; print $cgi->caption('MySQL calendar table output, Lesson 11:'); print ""; run_statement( "select date_format(curdate(), '%b %e, %Y');" ); my $today = $sth->fetchrow; run_statement("select dayofweek(curdate() );" ); my $dayofweek = $sth->fetchrow; #run_statement( "select date_format(curdate()-2,'%W');" ); #my $twodayago = $sth->fetchrow; #print "$twodayago "; my %WeekDays = ( Sunday=> 1, Monday=> 2, Tuesday => 3, Wednesday => 4, Thursday => 5, Friday=> 6, Saturday => 7 ); my ($day, $day1, $week,)= (0,0,0); my (@weeks, @weeks1, @weeks_anonymous,) = ((),(),()); ## Set up array with dates minus 15 days and plus 15 days from current date ## foreach $day ('-15' .. '15') { run_statement( "select date_format(date_add(curdate(), interval '$day' day), '%b %e, %Y');" ); push (@weeks, $sth->fetchrow); } ## Match up dates with dayofweek #'s ## foreach $day1 ('-15' .. '15') { run_statement( "select dayofweek(date_add(curdate(), interval '$day1' day));" ); push (@weeks1, $sth->fetchrow); } ## Begin Table ## print table({border=>undef}); #print Tr ({-align=>'CENTER',-valign=>'TOP'}); @weeks_anonymous = ( [$weeks[0], $weeks[1], $weeks[2], $weeks[3], $weeks[4], $weeks[5], $weeks[6] ], [$weeks[7], $weeks[8], $weeks[9], $weeks[10], $weeks[11], $weeks[12], $weeks[13] ], [$weeks[14], $weeks[15], $weeks[16], $weeks[17], $weeks[18], $weeks[19], $weeks[20] ], [$weeks[21], $weeks[22], $weeks[23], $weeks[24], $weeks[25], $weeks[26], $weeks[27] ], [$weeks[28], $weeks[29], $weeks[30], $weeks[31], undef, undef, undef ], ); foreach $element (@weeks_anonymous) { print Tr({-align=>'CENTER',-valign=>'TOP'}); for $date (@{$element}) { if (! defined $date) { print td (''); } elsif ($date eq $today) { print td(strong($date) ); } else { print td ($date); } } print $cgi->end_Tr; } print $cgi->end_html; Be a PS3 game guru. Get your game face on with the latest PS3 news and previews at Yahoo! Games. http://videogames.yahoo.com/platform?platform=120121 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: cgi calender
--- Tom Phoenix <[EMAIL PROTECTED]> wrote: > On 2/27/07, oryann9 <[EMAIL PROTECTED]> wrote: > > > Problem: cgi calender daynames are not matching up > > with dates. For example: Todays date 02/27/2007 is > > being printed under Thursday instead of Tuesday. > > Is the problem that you need to determine the day of > the week for a > given date, or that you need to get something to > line up vertically > with something else? > > From looking briefly at your code, you seem to be > using SQL to > manipulate dates and times. In Perl, it's generally > easier to use a > module to do that. (Unless, of course, using SQL is > part of the > homework assignment.) > > --Tom Phoenix > Stonehenge Perl Training > Tom, thank you for replying. Well I solved the first issue, determining the day of week for a given date using select dayofweek(curdate()), so yes I am having issues lining these days line up with dates b/c as the days move forward the foreach $day ('-15' .. '15') loop alters the table. This is a homework assignment for an online SQL class I am taking through O'reilly for continuing education even though I work as a Unix Engineer. Get your own web address. Have a HUGE year through Yahoo! Small Business. http://smallbusiness.yahoo.com/domains/?p=BESTDEAL -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: cgi calender
--- oryann9 <[EMAIL PROTECTED]> wrote: > --- Tom Phoenix <[EMAIL PROTECTED]> wrote: > > > On 2/27/07, oryann9 <[EMAIL PROTECTED]> wrote: > > > > > Problem: cgi calender daynames are not matching > up > > > with dates. For example: Todays date 02/27/2007 > is > > > being printed under Thursday instead of Tuesday. > > > > Is the problem that you need to determine the day > of > > the week for a > > given date, or that you need to get something to > > line up vertically > > with something else? > > > > From looking briefly at your code, you seem to be > > using SQL to > > manipulate dates and times. In Perl, it's > generally > > easier to use a > > module to do that. (Unless, of course, using SQL > is > > part of the > > homework assignment.) > > > > --Tom Phoenix > > Stonehenge Perl Training > > > > Tom, thank you for replying. Well I solved the > first > issue, determining the day of week for a given date > using select dayofweek(curdate()), so yes I am > having > issues lining these days line up with dates b/c as > the > days move forward the foreach $day ('-15' .. '15') > loop alters the table. This is a homework > assignment > for an online SQL class I am taking through O'reilly > for continuing education even though I work as a > Unix Engineer. > > Will anyone offer some kind help? Looking for earth-friendly autos? Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center. http://autos.yahoo.com/green_center/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: cgi calender
--- zentara <[EMAIL PROTECTED]> wrote: > On Wed, 28 Feb 2007 12:10:36 -0800 (PST), > [EMAIL PROTECTED] (oryann9) > wrote: > > >Will anyone offer some kind help? > > See: > http://perlmonks.org?node_id=599419 > > Or groups.google.com for "perl html cgi calendar". > > zentara > > -- Why did you send me that link? That does not help me. I use both sites to seek help when needed. I thought this was a list to get help because people here like to offer help after all we all love Perl?! I did google cgi calender, but I am not going to copy someones code because that defeats the purpose of learning. No need to miss a message. Get email on-the-go with Yahoo! Mail for Mobile. Get started. http://mobile.yahoo.com/mail -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: remove line if field one is duplicate
--- Chas Owens <[EMAIL PROTECTED]> wrote: > On 2/27/07, Keenan, Greg John (Greg)** CTR ** > <[EMAIL PROTECTED]> wrote: > > Hi, > > > > I have to combine several Unix password files and > remove any duplicate > > accounts - putting this into LDAP. > > > > I have the following code that will remove any > duplicate whole lines but > > I need to remove lines only if the first field of > the password file is a > > duplicate. > > This should work > > perl -ne 'print unless $h{(split/:/)[0]}++' > This is creating a anonymous hash, correct? We won't tell. Get more on shows you hate to love (and love to hate): Yahoo! TV's Guilty Pleasures list. http://tv.yahoo.com/collections/265 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: remove line if field one is duplicate
--- Chris Charley <[EMAIL PROTECTED]> wrote: > > > This is creating a anonymous hash, correct? > > This is saying > print unless the first field has been seen before > > which is what he wants his code to do. > > $h is a good short notation - but using %seen > instead of %h may make it clearer for you. > > perl -ne 'print unless $seen{(split/:/)[0]}++' > > Chris > I understand what its doing, but just wanted make sure if its creating a anonymous hash b/c of the { }. So is it b/c u never said yes or no? thank you TV dinner still cooling? Check out "Tonight's Picks" on Yahoo! TV. http://tv.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: cgi calender
> >Why did you send me that link? That does not help > me. > > Because you specifically said > > "Will anyone offer some kind help?" > > > >I use both sites to seek help when needed. I > thought > >this was a list to get help because people here > like > >to offer help after all we all love Perl?! I did > >google cgi calender, but I am not going to copy > >someones code because that defeats the purpose of > >learning. > > > Sorry if I aggravated you, but you sounded like > someone > begging for a free coding service, which this > maillist is not. > > Once again, sorry, > zentara > > No apologies needed! I was not aggravated at all and yes I do want to learn not just copy which is why I use and watch this list. Sorry for any misconceptions and sorry for pissing anyone off. I am a nice person who has a drive to master Perl, but at the same time I feel as if this list is against me b/c I do not write my questions in the most ideal way. derek (oryann9 => my all white cats name) :) 8:00? 8:25? 8:40? Find a flick in no time with the Yahoo! Search movie showtime shortcut. http://tools.search.yahoo.com/shortcuts/#news -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: cgi calender
> More than this I cannot offer. I don't know what > range of values your > $dayofweek variable holds so I can't even guess what > to code. > > Rob > No abuse was intended. Sorry. I like to send my thoughts on what to do for code to the list to see if I get any feedback regardless of whether they are right or wrong. Need Mail bonding? Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users. http://answers.yahoo.com/dir/?link=list&sid=396546091 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: confused about a regex
> $_=abc.e.i; > > This is short for: > > $_ = 'abc' . 'e' . 'i'; > > Which is the same as saying: > > $_ = 'abcei'; > Why is $_=abc.e.i short for $_ = 'abc' . 'e' . 'i'; Is it b/c each group of characters is a 'token' including the periods? abc => token . => token e => token . => token i => token >From the Perl CD: the lexical analyzer breaks it down into three tokens: print, "Hello, world!\n", and the final semicolon/ Sucker-punch spam with award-winning protection. Try the free Yahoo! Mail Beta. http://advision.webevents.yahoo.com/mailbeta/features_spam.html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: confused about a regex
Yes I understand now. For some reason I missed the missing quotes in the original post and the word token came to mind. $ perl -MO=Deparse foo.plx BEGIN { $^W = 1; } use diagnostics; sub abc { use warnings; use strict 'refs'; 'abc.'; } sub e { use warnings; use strict 'refs'; 'e.'; } sub i { use warnings; use strict 'refs'; 'i'; } use warnings; use strict 'refs'; $_ = abc() . e() . i(); print "$_\n"; foo.plx syntax OK Need Mail bonding? Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users. http://answers.yahoo.com/dir/?link=list&sid=396546091 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
cgi Calendar continued.
My goal is to correlate the data in 2 arrays into a HoH or a HoA so that when I print this data in an HTML table so it comes out correctly. snippet... my (@weeks, @weeks1, @weeks_AoA,) = ((),(),()); ## Set up array with dates minus 15 days and plus 15 days from current date ## foreach $day ('-15' .. '15') { run_statement( "select date_format(date_add(curdate (), interval '$day' day), '%b %e, %Y');" ); push (@weeks, $sth->fetchrow); } ## Match up dates with dayofweek numbers with above array ## foreach $day1 ('-15' .. '15') { run_statement( "select dayofweek(date_add(curdate(), interval '$day1' day));" ); push (@weeks1, $sth->fetchrow); } I then setup this hash: my %WeekDays = ( 1 => Sunday, 2 => Monday, 3 => Tuesday, 4 => Wednesday, 5 => Thursday, 6 => Friday, 7 => Saturday ); But my problem is figuring out which data structure to use considering the following: correlate/match-up the two array's data elements. For example, in @week an element is 'Mar 9 2007' and its correlated element in @weeks1 is '6' and 6 in %WeekDays is 'Friday.' I see a HoH or a HoHoH ? ## To build: my %HoH = (); foreach my $dates (@weeks) { foreach my $daynums (@weeks1) { $HoH{$dates} = { daynums => $daynums }; } } ## To print: for my $a ( keys %HoH ) { for my $e ( keys %{ $HoH{ $a } } ) { print $HoH{ $a }{ $e }; } } but its printing all 7's and 7 = Saturday in ODBC standards. Any advise? thank you It's here! Your new message! Get new email alerts with the free Yahoo! Toolbar. http://tools.search.yahoo.com/toolbar/features/mail/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
template toolkit
All, Is the Perl template toolkit a popular tool to use for mid tier to senior Perl developers? Reason I ask is because from the description it states "And because it has its own simple templating language, templates can be written and edited by people who don't know Perl." Among the many different approaches to "templating" with Perl--such as Embperl, Mason, HTML::Template, and hundreds of other lesser known systems--the Template Toolkit is widely recognized as one of the most versatile. Like other templating systems, the Template Toolkit allows programmers to embed Perl code and custom macros into HTML documents in order to create customized documents on the fly. But unlike the others, the Template Toolkit is as facile at producing HTML as it is at producing XML, PDF, or any other output format. And because it has its own simple templating language, templates can be written and edited by people who don't know Perl. In short, the Template Toolkit combines the best features of its competitors, with ease-of-use and flexibility, resulting in a technology that's fast, powerful and extensible, and ideally suited to the production and maintenance of web content and other dynamic document systems. Now that's room service! Choose from over 150,000 hotels in 45,000 destinations on Yahoo! Travel to find your fit. http://farechase.yahoo.com/promo-generic-14795097 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: template toolkit
> oryann9> All, > oryann9> Is the Perl template toolkit a popular tool > to use for > oryann9> mid tier to senior Perl developers? > > I'm about as senior as they get for Perl developers > {grin}, and it's clearly > my templating language of choice. > OK great, Thx for responding! I read the CPAN module and was a bit thrown for a minute b/c it has its own sort of syntax and stanzas. see http://search.cpan.org/~abw/Template-Toolkit-2.18/lib/Template/Tutorial/Web.pod My next question is of those people that use is, how sucessful has it been, meaning was mgmt happy with it, were the developers happy with it? It's here! Your new message! Get new email alerts with the free Yahoo! Toolbar. http://tools.search.yahoo.com/toolbar/features/mail/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
perldoc -q "How can I make my Perl program run faster?"
On this FAQ I read: If you're currently linking your perl executable to a shared libc.so, you can often gain a 10-25% performance benefit by rebuilding it to link with a static libc.a instead. This will make a bigger perl exe-cutable, but your Perl programs (and programmers) may thank you for it. See the INSTALL file in the source distribution for more information. All I found in the INSTALL file was this block of text. On some systems that support dynamic loading, it may be possible to replace libperl.a with a shared libperl.so. If you anticipate building several different perl binaries (e.g. by embedding libperl into different programs, or by using the optional compiler extension), then you might wish to build a shared libperl.so so that all your binaries can share the same library. Is this libc.a linking still true for Perl version 5.8?From perl -V I see: Am I linked to libc.a? Linker and Libraries: ld='ld2', ldflags =' -s -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lgdbm -ldb -lcrypt -lgdbm_compat perllibs=-lcrypt -lgdbm_compat libc=/usr/lib/libc.a, so=dll, useshrplib=true, libperl=libperl.a gnulibc_version='' thank you... Now that's room service! Choose from over 150,000 hotels in 45,000 destinations on Yahoo! Travel to find your fit. http://farechase.yahoo.com/promo-generic-14795097 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/