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

sarani's scratchpad

by sarani (Sexton)
on May 22, 2006 at 12:16 UTC ( #550916=scratchpad: print w/replies, xml ) Need Help??

#! /root/bin/perl
use strict;
use warnings;
use subs;

sub square;
sub read;
sub dist;

my $r; my $r2;

my $xh; my $yh; my $zh;
my $f1; my $FILE1; my $hline; my @hlines;

my $x1; my $y1; my $z1;
my $f2; my $FILE2; my $pline; my @plines;

open (FILE1, "$f1") or die "Argh! File not opened! $!";
open (FILE2, "$f2") or die "Argh! Second file not opened! $!";
while (<FILE1>)
{ $hline=<FILE1>;
push (@hlines,$hline);

while (<FILE2>)
{ $pline=<FILE2>;
push (@plines,$pline);
close FILE2;
close FILE1;

print @hlines;
print @plines;

sub dist
foreach $hline (@hlines)
$xh= substr $hline,31,8;
$yh= substr $hline,40,8;
$zh= substr $hline,48,8;
foreach $pline (@plines)
print '"',$pline,'": len=',length($pline),"\n";
$x1= substr $pline,31,8;
$y1= substr $pline,40,8;
$z1= substr $pline,48,8;

print "$r2 and square root is $r\n";
{ print "match!"}
print $i;
return 1;

sub square
my $num; my $sq;
$sq = $num * $num;
return $sq;

sub read
print "Enter file name:";
return $a;
Log In?

What's my password?
Create A New User
[atcroft]: stevieb: Sad to say that I only recently learned that particular trick, but I have since found it very useful.... :)
[james28909]: ill be back with a solution eventually
[stevieb]: it's a reminder to re-inforce it :P
[atcroft]: james28909: That particular questions was a bit of trick, actually (depending on the country you are in). More interesting is, if you are trying to subtract from an epoch time, for instance, you might have to consider when/if DST occurs for a location,
[atcroft]: because you may have to adjust the number of seconds you change from an epoch from 86400 (not to mention leap seconds)....
[atcroft]: james28909: Although if your program is using a database, you might be able to "pass the buck" to the database and ask it to do the date change for you....

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2017-04-29 04:37 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (531 votes). Check out past polls.