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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by raider2001

  1. raider2001

    Getting rid of the cmd window

    Are you running the main process from a command window or a Perl/Tk widget? Anyways I have used "wPerl" with Perl/Tk to eliminate the command window for the main process. The "wPerl" file is available in ActiveState Perl package. To use it, just associate the shortcut for your Perl/Tk...
  2. raider2001

    How to recognize an int or a float

    Here's another way: sub VerifyInt($); $a = '88.0.5'; $R = VerifyInt($a); if ($R == 0) { print "$a is not a valid number \n"; } elsif ($R == 1) { print "$a is an integer\n"; } else { print "$a has a decimal point\n"; } sub VerifyInt($) { $Number = "@_"; $NumDecPoint++ while...
  3. raider2001

    How to recognize an int or a float

    How about using pattern matching? if ($a =~ /\./) { # $a has a decimal point } else { # $a is an integer }
  4. raider2001

    Step through Array of Arrays with unknown Size

    No need to know the sizes of the array. You can just use a foreach loop like this: @list1 = ("one", "two", "three"); @list2 = ("myList2"); @fooList = ([@list2], [@list1]); foreach $refarray (@fooList) { foreach $item (@{$refarray}) { print "$item\n"; } }
  5. raider2001

    Perl TK Buttons Not Redrawing During Subroutine Exec.

    The problem is that widget are normally just updating during idle times. To force the update, run $widget->update. Here is your code modified to add the updates. use strict; use warnings; use Tk; my $main = MainWindow->new; my $message = "Some text"; my $frame = $main->Frame; my $Label =...
  6. raider2001

    Telnet question,

    Don't have time to lookup what "TelnetMode => 0" does, but I suspect that may be part of the problem or your prompt doesn't match the default prompt. Here is a portion of a program I have that works for a Solaris machine. use Net::Telnet; my $host = "myhost"; my $user =...
  7. raider2001

    How to write each word in a text file on a new line

    The following should do the trick. Comments added for clarification. $file = &quot;temp.txt&quot;; $RecSep = $/; # Save input record separator undef($/); # Undefine input record separator open(F, $file) or die &quot;Can't open $file: $!\n&quot;; $contents = <F>; # Read all of file into a...
  8. raider2001

    Regex push $1 help

    nfaber, My mistake I put a backslash instead of a slash for the input record separator. It should be '$/'.
  9. raider2001

    Regex push $1 help

    By default the input record separator is a new line. So each time you read from a file, it reads one line at a time. But since you want to read data between 'DESCRIPTION' strings, you should redefine the input record separator to DESCRIPTION like this: my $filename =...
  10. raider2001

    Problems with specific search in string

    One way is to split the string into characters and count how many of each one. Here's an example: @strings = (&quot;abcabc&quot;, &quot;abcdabcd&quot;, &quot;abcabcc&quot;, &quot;abcabcb&quot;, &quot;abc&quot;, &quot;aaa&quot;, &quot;abbccbcaaacc&quot;); foreach $string (@strings) { @chars...
  11. raider2001

    Custom sorting records by date (without SQL)

    This is easy enough to do with sort. See the example below: @list = (&quot;01/22/2000&quot;, &quot;01/21/2001&quot;, &quot;08/08/2000&quot;, &quot;12/12/2000&quot;, &quot;09/09/1999&quot;); sub mysort() { @data1 = split (&quot;/&quot;,$a); @data2 = split (&quot;/&quot;,$b)...
  12. raider2001

    mv command

    One thing I noticed was that the top one includes the directory name in the mv, but the bottom one doesn't. See change in red: $line = &quot;vcx@xxx.xxx.xxx.xxx@01.09.04-14.02.50&quot;; @comb = split(/\@/,$line); $a1 = $comb[0]; $a2 = $comb[1]; $a3 = $comb[2]; $b = &quot;/tmp/tmpdir/&quot;; $c...
  13. raider2001

    dynamic variables

    Sounds like you want a hash. Here's an example: %Price = ( bread => '1.99', eggs => '1.54', milk => '2.39', ); foreach $Item (sort keys %Price) { print &quot;The price of $Item is \$$Price{$Item}\n&quot;; }
  14. raider2001

    Automate user input = 'yes' or 'y'

    Sounds like a job for Expect or Perl::Expect.
  15. raider2001

    Converting script from Windows to Linux - RE issues

    Try 'chomp' to remove the new line character, which differs between linux and windows.

Part and Inventory Search

Back
Top