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!

Search results for query: *

  1. raklet

    Explain $[

    What is the special variable $[.
  2. raklet

    Output a number in money format

    Try this: use Number::Format; my $x = new Number::Format(-decimal_fill => 1); $formatted = $x->format_number(221659.20); print "\$$formatted"; I believe the module comes default with perl. Read the docs for full information on use of the module...
  3. raklet

    Check date string for day of week

    Got to put a filename on the end of your path. move("$filename", "$badpath\\file.ord"); # or whatever you are going to call it. Raklet
  4. raklet

    Check date string for day of week

    Here is one way. use Date::Manip; my $date = '20060811'; my $day_of_week = UnixDate($date,"%A"); print $day_of_week;
  5. raklet

    Perl/Tk - positioning buttons in row

    The pack method has to be passed -side => 'left' in order for the buttons to line up side by side. But the buttons will also cling to the left side of the main window. If you want the buttons to be in the exact center, you have to create a new frame, anchor it in the center, and the pack the...
  6. raklet

    tabs to spaces

    Some other problems with your code. If you are only passing one file name from the command line, then you need to call $ARGV[0] not $ARGV[1]. You should also use strict and add error checking to your file reads and file writes. It will go a long way to helping troubleshoot problems. Here is...
  7. raklet

    tabs to spaces

    You have to open a filehandle for writing out, otherwise you are just printing to the screen. open OUT, "$new_file"; ... print OUT @LINES;
  8. raklet

    tabs to spaces

    The regular expression doesn't do variable interpolation properly of whitespace characters. Hard code the regex instead. $lines =~ s/\t/ /gx;
  9. raklet

    Tk drag to move toplevel window

    Nice work on that piece. I was quoting straight out of the documentation in Mastering Perl/Tk. It uses the term "root window" - whatever that means.
  10. raklet

    Tk drag to move toplevel window

    Kirsle, my $curX = $Tk::event->x; my $curY = $Tk::event->y; needs to read my $curX = $Tk::event->X; my $curY = $Tk::event->Y; The X and Y needs to be capitalized. Small caps xy returns the event's coordinate relative to the widget. Upper caps XY returns the event's...
  11. raklet

    Improve my program:(working with files, email contents)

    Another way to do it would be to split the string along spaces and use an array slice to capture the values: while(<DATA>){ my @vals = (split/\s+/)[2,3,4,5,6,7,9,10,11,12]; print join(' ', @vals) . "\n"; } __DATA__ 1152897223 4 Fri 07 14 13:13:43 2006 Node1 M NW IC-3 Node Up Node1...
  12. raklet

    Array Range Problem

    Ishnid, I understand what you are saying. Very valuable insight. Have a star.
  13. raklet

    How to parse out records that begin with &quot;./&quot;?

    use strict; open (IN, "$file"); # The data file: replace $file with path to file open (OUT, ">$new_file"); # Open a file to write to while (<IN>) { # Read IN file line by line chomp; if (/^\.\//) { # Look for ./ my ($junk,$string) = split(/=/); # Split on the = sign print...
  14. raklet

    killing windows process

    Windows has always been weak in this area, but they introduced a new program called taskkill in Windows XP. You could execute it with a system call from a perl script. c:\>taskkill /? # get all the details on usage Or I would recommend using a third party command line app. This freeware app...
  15. raklet

    How to read only certain lines of file

    Ishnid, How would you modify your "buffer of sorts" to capture all of the numerical data. That particular snippet only captures the first ten lines of numbers, but leaves off substantially more. Chep80, I know your file is some 40,000+ lines, so you may not want to read the whole thing into...
  16. raklet

    Tk - Tying events to closing a window

    From Mastering Perl/Tk Never used this method so I can't give a specific example, but maybe this link will help. http://www.codecomments.com/archive234-2004-9-279207.html
  17. raklet

    Converting a matrix from scientific to floating point

    To print the file back out, use this code (other minor code corrections also included): use strict; use Math::BigFloat; open(IN, "c:/temp/data.txt"); open(OUT, ">c:/temp/newdata.txt"); my $convert; while (<IN>) { if ($convert) { my @vals = split(/ /); foreach my $num...
  18. raklet

    Converting a matrix from scientific to floating point

    No problem. The __DATA__ is there just for testing and demonstration purposes. I don't have the file, so I can't code it exactly. Here is an approximation: use strict; use Math::BigFloat; open(IN, "c:/temp/data.txt"); my $convert; while (<IN>) { if ($convert) { my @vals =...
  19. raklet

    Converting a matrix from scientific to floating point

    Oops, small bug in the code. use strict; use Math::BigFloat; my $convert; while (<DATA>) { if ($convert) { my @vals = split(/ /); foreach my $num (@vals) { my $x = Math::BigFloat->new($num); print $x->bstr() . " "; } print "\n"; }...
  20. raklet

    Converting a matrix from scientific to floating point

    What do you think of this? use strict; use Math::BigFloat; my $convert; while (<DATA>) { if ($convert) { chomp; my @vals = split(/ /); foreach my $num (@vals) { my $x = Math::BigFloat->new($num); print $x->bstr() . " "; } print...

Part and Inventory Search

Back
Top