Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

SciDude's scratchpad

by SciDude (Friar)
on Jun 01, 2004 at 21:05 UTC ( #358605=scratchpad: print w/replies, xml ) Need Help??

Forking from inside ptk:

# my $pid; # if (!defined($pid = fork)) { # warn "cannot fork: $!"; # return; # } elsif ($pid) { # warn "begat $pid"; # return; # Iím the parent # } # exec 'mozilla', '-url', "$url"; or use $pid = fork; exec 'mozilla', '-url', $url unless defined $pid;

Standard Sentence Boundary Code:

/ ( .+? # match (non-greedy) anything ... [.!?] # ... followed by any one of !?. [")]? # ... and optionally " or ) ) (?= # with lookahead that it is followed by ... (?: # either ... \s+ # some whitespace ... ["(]? # maybe a " or ( ... [A-Z] # and capital letter | # or ... \s*$ # optional whitespace, followed by end of string ) ) /gx ;

To find if a directory exists;

use Cwd; my $dir = getcwd; #find root of script print "Current Directory is $dir\n"; print "Appending skudb to dir\n"; $dir = $dir . "skudb"; if (-d $dir) { chdir $dir; #move into the new directory #do some stuff in $dir here } else { mkdir $dir }

Or a better version perhaps

use Cwd 'chdir'; #That overrides chdir to update $ENV{PWD} my $dir = getcwd; #find root of script print "Current Directory is $dir\n"; print "Appending skudb to dir\n"; $dir = $dir . "skudb"; unless (-d $dir) { mkdir $dir } chdir $dir; #move into the new directory print $ENV{'PWD'}; #do some stuff in $dir here

For Sulfericacid Here is a countdown until 2am for you
my ($sec2, $min2, $hour2) = localtime(time); print "Whole hours remaining until midnight: (24-$hour2)=";print 24-$h +our2;print" hours\n"; print "Minutes remaining until next hour: (60-$min2)=";print 60-$min2; +print" minutes\n"; if ($hour2>2) { $newdayhours = 24-$hour2+2; $min2=60-$min2; print "There are $newdayhours hour(s) and $min2 minute(s) until the ne +w day."; } else { print "There are ";print 2-$hour2;print" hour(s) and ";print 60-$min2; +print " minute(s) until the new day."; }

Remember to put some new stuff here!
Add CB history link(s) on "Other CB clients" page?
Re^2: cgi write then rewrite
PerlMol - Perl Modules for Molecular Chemistry
What is the best way to arrange widgets using TK?

Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2023-01-28 00:59 GMT
Find Nodes?
    Voting Booth?

    No recent polls found