Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2017-08-17 13:50 GMT
Find Nodes?
    Voting Booth?
    Who is your favorite scientist and why?

    Results (288 votes). Check out past polls.