Within a subroutine, I need to pass in two parameters...a current value (which will be passed in from the value array), and the previous value (the element in the value array BEFORE the current element). I need it to do this for every function call. Any suggestions? The array length varies each...
I'd like to write a subroutine that performs an average of a variable over a specific layer of the atmosphere. In order to do the averaging, I need to pass in the values I wish to average (that part's easy), the current altitude (also easy), but then I also need the previous altitude since I am...
I'm able to get the program to create the directory, but I can't get it to stick the files in it.
I have something like...
mkdir "dirname";
opendir (dir, dirname);
open (file, >'/dirname/filename.txt');
print file "testing 123";
That's off the top of my head so there may be a syntax error...
Anyone have any suggestions of how to print numerical data out to a file in neatly organized columns? I've seen it done with a for loop, but I'm thinking formatted print. Any ideas?
Thanks!
Stupid question...but how come in the loop if I print the array all the numbers in range show up, but outside of the loop only the last one (2454378) does? I'd like to be able to store all of these numbers (julian dates) into an array that I can manipulate the elements of later. Any ideas...
Within an array of files, I'd like to search for files with a specific pattern. All the files follow a standard format (for example, abc123.YEAR.MONTH.DAY.abc.TIME). I'm trying to use grep but I think my implementation may be incorrect. Here's an example of how I'm trying to do things...
I can't seem to figure out why the subroutine is only returning the 3 values for the last element in the array I am passing to it in the foreach statement. The array @juliandate contains two elements, so I'd like to perform the calculation for both elements. Can anyone enlighten me as to where...
Is there a way to do integer division in Perl similar to C's "div" operator?
I'm trying to implement the following algorithm to convert Julian Date to Gregorian and it requires integer division otherwise it breaks down.
Thanks!
l = jd + 68569
n = ( 4 * l ) / 146097
l = l -...
Below is my current code. I have the user enter a year, month, date and time. What I'd like to do is consolidate this all into one line...the user can enter it in a certain format like YYYYMMDDTT and the program will extract the year, month, and date from what's entered and format it the same...
In the second foreach loop, I simply want to apply each value in the array into that equation. It appears to be combining them. I can't find a good internet reference. Any help would be appreciated.
#!/usr/local/bin/perl -w
use strict;
my (@temps, $item, $MYFILE, $val, $es);
@temps = ('-12'...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.