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 strongm 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. hmerrill

    ARGV question

    You might try looking at the Getopt::Std module, or the Getopt::Long module - read the perldocs on these modules that come included with Perl by doing perldoc Getopt::Std or perldoc Getopt::Long at a command prompt. HTH. Hardy Merrill
  2. hmerrill

    for web applications, what does perl have over php?

    I'll add a few cents of my own ;-) I've used both - Perl is a more mature, very stable language - I like Perl a lot - for everything. Perl as DBI for database integration, which is excellent and rock solid - as of 1 1/2 years ago(I haven't used PHP in the last year and a half), PHP didn't have...
  3. hmerrill

    Finding the Modification Date on a file

    Backticks is the easiest solution, but just for the sake of completeness, I'll offer this: $ls_command = &quot;ls -rltd $file |&quot;; open(LS_COMMAND,&quot;ls -l message |) || die &quot;Can't open the ls command!&quot;; while (<LS_COMMAND>) { print &quot;Here is a line of ls output...
  4. hmerrill

    A Small Perl Program involving mysql I need help with.

    Are you using the DBI and DBD::mysql modules in Perl? Assuming you have DBI and DBD::mysql installed, you could create a script do this: 1. connect to mysql database 2. select all rows in table B 3. for each row in table B save value of column x in variable $x SELECT x...
  5. hmerrill

    Get All The Current Environment Variables Into An Array

    jamisar, sorting was something that I chose to do - it is *NOT* necessary. I copied and pasted that from something I use to display the enviroment variables in a cgi script, and the sort just happened to be in there. HTH. Hardy Merrill Hardy Merrill
  6. hmerrill

    Get All The Current Environment Variables Into An Array

    The environment variables are in the %ENV hash - do this: foreach $key (sort keys %ENV) { print &quot;$key=$ENV{$key}\n&quot;; } HTH. Hardy Merrill
  7. hmerrill

    getopt - won't allow an option to have param, or NOT have param

    I'm a python newbie, and I'm trying to use &quot;getopt&quot; to process command line arguments. I'd like to be able to specify a command line option that *could* have an associated argument, but getopt is forcing me to declare each option to be *either* 1. with an associated argument *or*...
  8. hmerrill

    Is there any data type validation in perl?

    You really need to read up on Perl - start by doing perldoc perl at a command prompt. The way data validation is done in Perl is normally by using regular expressions - read about Perl regular expressions by doing perldoc requick and/or perldoc perlretut HTH. Hardy Merrill
  9. hmerrill

    single digit decimal to 2 digit hex

    This works: printf &quot;%02x%02x%02x\n&quot;, 0,1,2; HTH. Hardy Merrill
  10. hmerrill

    how to match multichar atoms in regexp?

    /([^(asdf)]*)/ The square brackets means character class - each character in between the square brackets is a member of a character class that you are defining. When you say [^(asdf)] you are really saying match any character which is not(^) one of the characters &quot;(&quot;, &quot;a&quot...
  11. hmerrill

    writing .txt files outside of CGI directory (apache/win98se) ???

    How did you figure that out? I just looked through the 'perldoc perlwin32' and I didn't see anything like that - I couldn't really find anything on windows paths needing the directories separated by *forward* slashes. I'm confused ;-) Hardy Merrill
  12. hmerrill

    writing .txt files outside of CGI directory (apache/win98se) ???

    Does your open look like open(LOG, &quot;>C:\Program Files\Abria Merlin\Apache\htdocs\site\test1.txt&quot;) || &ErrorMessage; ??? What error message(s) are you getting? Not sure about Windows, but on *nix, you need to ensure that the user(&quot;apache&quot; or &quot;nobody&quot; or ???)...
  13. hmerrill

    How can I make a perl program to wait

    The &quot;sleep&quot; function usually works - not sure on Win NT thought. Do 'perldoc -f sleep' at a command prompt to see the perldocs on &quot;sleep&quot;. HTH. Hardy Merrill
  14. hmerrill

    Sybase DBD issue

    If you don't get an answer here or in MS SQL, ask your question on the DBI mailing list - there are many excellent people on that list, including many who are very knowledgable about Sybase and DBD::Sybase. HTH. Hardy Merrill
  15. hmerrill

    Finding the first instance only of a number in a file

    my $abs_file = &quot;/path/to/file&quot;; open(IN, &quot;<$abs_file&quot;) || die &quot;Can't open $abs_file!&quot; while(<IN>) { if (/^\d\d\d/) { ### This is a good line - it starts with 3 digits } } HTH. Hardy Merrill
  16. hmerrill

    Easy question for an easy answer. PERL/database

    I can't be much help on the Windows platform - I'm on Red Hat Linux 7.3. Assuming you'll use ODBC, you'll need DBI and DBD::ODBC (I think - I've never used ODBC, but I'm pretty sure that's what the DBD driver is called) - you can find them at www.cpan.org, or search.cpan.org. Once you've...
  17. hmerrill

    Creation date and time.

    If Perl can do it, my guess is that the &quot;stat&quot; function would be *the* function. But according to 'perldoc -f stat' stat FILEHANDLE stat EXPR stat Returns a 13-element list giving the status info for a file, either the file opened via...
  18. hmerrill

    I want STDOUT's filename!

    I guess I don't understand. Won't my $stdout = \*STDOUT; give you what you want in $stdout? Then, if you do print $stdout &quot;Some text or something\n&quot;; won't that go to the file that STDOUT is pointing to? What am I missing? Hardy Merrill
  19. hmerrill

    the DIE command

    At a command prompt, do perldoc -f die to read what the &quot;die&quot; does. You could say open(MCF,&quot;member_colour_file.txt&quot;) || print &quot;error message&quot;; but after printing &quot;error message&quot;, your program would continue on, which is not what you want. I'd...
  20. hmerrill

    Perl for Lamers?

    One thing I forgot to mention - if your system already has Perl on it, Perl *comes with* excellent documentation called &quot;perldocs&quot;. To get started, you can do perldoc perl at a command prompt - that will list all the different topics covered by the perldocs. Then, to look at one...

Part and Inventory Search

Back
Top