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 Mike Lewis 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. septemberlogic

    Use PERL to confirm a word is in a file.

    Hi, I guess what you can do is: $string="false"; open(FNAME, 'c:\Scripts\phile.txt') or die "I can't find your file\n"; while (<FNAME>){ if(/word/){ $string = "true"; last; } } close(FNAME); print $string;
  2. septemberlogic

    RegEx Question

    Miller, Thanks for your reply. I can't say I fully understand what's going on yet. I'm a quasi-programmer who only codes if I have a project that requires some sort of automated file/text manipulation (and that's very rare). I will read up on what exactly every line in your code does. Thanks...
  3. septemberlogic

    RegEx Question

    Hi Kevin, The ijk's are going to be loop variables. So it's like writing out the summation series in loops. Anyway I've decided to do it a more complicated way, so that I can make sure the substitution takes place even if there're random whitespace characters in the square brackets. Here's my...
  4. septemberlogic

    RegEx Question

    Thanks Kevin. Even though the example I gave was two dimensional, there are potentially multi-dimensional equations, such as Vin[i, j, k]. Is there a more general way of searching and replacing within the square brackets? Thanks!
  5. septemberlogic

    RegEx Question

    Hi, For the following string, $str = "Vin[i,j] + Vout[i,j] + Uin[i,j] + Uout[i,j]"; I want to replace the i's and j's in the square brackets with actually indices. So something like "$str =~ s/i/2/g", except for that changes the variable name as well (Vin becomes V2n). So my questions is, how...
  6. septemberlogic

    Question about using Date::Calc, and a general question about Perl

    Ah I see. I will do that then! Thanks Kevin!
  7. septemberlogic

    Question about using Date::Calc, and a general question about Perl

    Thanks Kevin! I'll check it out. What about my previous question: I have created a Date object with the following line: $myDate = Date::Calc->today(); How do I find out which day of the week it is? One way to do so is: print Day_of_Week($myDate->year(),$myDate->month(),$myDate->day()); but...
  8. septemberlogic

    Question about using Date::Calc, and a general question about Perl

    If that's the case, why did I have to use: Date::Calc->today() instead of today()? I tried the latter and it didn't work. Thanks Kirsle!!
  9. septemberlogic

    Question about using Date::Calc, and a general question about Perl

    One quick question: I have created a Date object with the following line: $myDate = Date::Calc->today(); How do I find out which day of the week is it? One way to do so is: print Day_of_Week($myDate->year(),$myDate->month(),$myDate->day()); but it feels like there's gotta be some easier way...
  10. septemberlogic

    Question about using Date::Calc, and a general question about Perl

    Kevin, Thanks. Now that makes sense. So you are saying that by using the module, I'm just using its member subroutines to manipulate 3-element arrays? Thanks again!
  11. septemberlogic

    Question about using Date::Calc, and a general question about Perl

    Hi, I've had some past experience in C++ and Java but I'm pretty new to Perl. I was trying to use the Date::Calc module, after briefly looking through the Calc.pod page on CPAN, I realized that I didn't even know how to create a new Date object. In Java, it would be something like: Date...
  12. septemberlogic

    Installing CPAN Perl modules under Cygwin

    Never mind I figured it out. Thanks anyway!
  13. septemberlogic

    Perl on a Macintosh

    I haven't used a Mac in a while but I think all you have to do is to change the permission of the Perl script to executable and you will be able to launch it by double clicking.
  14. septemberlogic

    Installing CPAN Perl modules under Cygwin

    Hi, I tried following the instructions on CSPAN for installing Perl modules under CygWin, but it was not successful at all. Does anyone know any webpage with instructions to do so? Sorry if this is a n00b question - I'm just starting to pick up Perl! Thanks in advance!

Part and Inventory Search

Back
Top