Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. StormMedic85

    Easy way to pass in previous array element?

    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...
  2. StormMedic85

    Passing in a previous value into subroutine...

    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...
  3. StormMedic85

    Add files to a new directory in Perl?

    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...
  4. StormMedic85

    Printing data out in columns?

    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!
  5. StormMedic85

    stupid question involving for loops

    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...
  6. StormMedic85

    Proper Way To Use Grep?

    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...
  7. StormMedic85

    Perl Subroutine Question Involving Arrays...

    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...
  8. StormMedic85

    Perl Integer Division

    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 -...
  9. StormMedic85

    Perl Julian Day

    Does anyone know of a good way to convert a time in seconds since epoch accurately to Julian Day without using a CPAN module? Thanks!
  10. StormMedic85

    There's got to be an easier way to do this. STDIN and sprintf question

    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...
  11. StormMedic85

    Perl Array Question...

    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'...

Part and Inventory Search

Back
Top