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 Chris 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. rharsh

    in Perl find call looking to exclude folder and ignore duplicate finds.

    Hey there, not sure if you're still looking for solutions since this is from a couple weeks ago. If you are still looking, what would be the duplicates that you want to exclude? Would it just be filenames that are duplicated or some portion of the path, or something else?
  2. rharsh

    Convert Comma Separated List of INTs to a Range

    Wow, thank you! Lots to read through there. Thank you for the links and the sample code!
  3. rharsh

    Convert Comma Separated List of INTs to a Range

    Thank you for the response, the field has values that are a list, some examples would be: '1,' '1,2,3,4,5,' '1,2,3,5,6,10,' And I'd like to convert it to a range (or ranges) if possible. Using those examples, something like: '1' '1-5' '1-3,5-6,10' I've continued searching and it seems the...
  4. rharsh

    Convert Comma Separated List of INTs to a Range

    I have a series of string values that are generally a contiguous list of integers in a format of "1,2,3,4,5," -- although sometimes there can be contiguous ranges mixed with non-contiguous entries, such as "0,1,2,3,10,13,20,21,22,". What I'm hoping to do is convert them to a range notation. So...
  5. rharsh

    Print from CSV

    It seems like the first line of data (the one with 'green') may have an error -- and there was no attachment. So taking what you entered as a sample, here you go: use warnings; use strict; my %tiers; my $fh = *DATA; my $headers = <$fh>; # Grab Headers while (<$fh>) { next if /^\s*$/; # Skip...
  6. rharsh

    How to print string with comma in single column of csv

    Could you please provide some actual sample log data (with any sensitive information scrubbed) and your expected results for any of that data? Otherwise we're just making guesses. Thanks!
  7. rharsh

    delete file with similar names

    I might do something like this: use warnings; use strict; use File::Find; my $dir = './txt/'; # Change this to your directory my $month = '07'; # Get this from STDIN, command line, etc. find( {wanted => \&remove_files_by_month, follow => 0}, $dir); sub remove_files_by_month() { if (-f $_) {...
  8. rharsh

    Win32::GUI - need to create a window with scroll bar , within a main window

    Looks like you might need to write some code to handle the scrolling? I found this looking around on google: [link]http://rob.themayfamily.me.uk/perl/win32-gui/scrollbars/sb3[/url] That link is to part 3 of the tutorial which is where the scroll bars are added (I believe you said you already...
  9. rharsh

    sprintf() not returning expected result

    What is the data type of that field in your database? If you print everything without using printf/sprintf (so, just using print) are the values what you expect (without the leading zeros)?
  10. rharsh

    sprintf() not returning expected result

    Another thought is, are you suing the sprintf statement to do rounding of a floating point number? That could be causing problems.
  11. rharsh

    sprintf() not returning expected result

    I imagine it's getting changed somewhere else. If I run the code you posted, I get the following results: NFC_AMT before adding zeroes: 115 NFC_AMT after adding zeroes: 0000115
  12. rharsh

    rename multiple files in a directory with one command

    And using the script listed above, you could rename the files by using the command:rename.pl "s/\.dbf$/\.arc/i" *.dbf
  13. rharsh

    rename multiple files in a directory with one command

    Not exactly what you're looking for since it's not a one-liner, but if you're going to be renaming files like this a lot -- this could come in handy: #!/usr/bin/perl # -w switch is off bc HERE docs cause erroneous messages to be displayed under Cygwin #From the Perl Cookbook, Ch. 9.9 # rename -...
  14. rharsh

    Questions about Getopt::Long

    If you're just going to be using single letter switches, I'd suggest using GetOpt::Std. If you're going to stick with GetOpt::Long, the module is working like it should. Your 'e' option requires a string as an argument, it got one: '-d'. So -d isn't being read as a switch/option, but as an...
  15. rharsh

    Questions about Getopt::Long

    This is probably going to be easier... change use Getopt::Long; to this use Getopt::Long qw(:config no_auto_abbrev);
  16. rharsh

    Questions about Getopt::Long

    Did you read the perdocs on Getopt::Long? There's a lot in there, but the bit below was near the top. In the "Getting Started with Getopt::Long" section, the approximately fourth paragraph reads: The auto_abbrev option looks like it handles the specific behavior you were noticing.
  17. rharsh

    Please help me to understand how Dumper() works.

    So, first, in order to get the result you expect, you could use this instead: for(my $i = 0; $i <= $#a1; $i++) { $h1{$i} = [@a1]; #\@a1; } The difference there is that $h1{$i} is assigned a reference to an anonymous array that contains all the elements in @a1 (so there will be a unique...
  18. rharsh

    How to sort an all-digit matrix

    You're welcome, let me know if I can answer any questions for you.
  19. rharsh

    How to sort an all-digit matrix

    Oops, use this instead (works the same, but less changes if $sort_idx needs to be updated.) sub sort_sub { my $sort_col = shift; my $sort_idx = $sort_col - 1; # May not be necessary to subtract 1 if ($a->[$sort_idx] eq $b->[$sort_idx]) { if (scalar @_) { return &sort_sub(@_); }...
  20. rharsh

    How to sort an all-digit matrix

    This should give you a start, you'll probably want to do a bit more error checking in the sort subroutine, but a custom sort seems like the way to go. The sort sub below uses recursion to deal with the unknown number of columns that will be used to sort. Since I'm not entirely sure what you're...

Part and Inventory Search

Back
Top