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. regex7

    Regex's

    As I understood, only parts containing a dot should be considered to be filenames. So you could take this script as a start: #!/usr/bin/perl -w use strict; my @urls = qw(http://123.domain.123 http://123.domain.123/Dir http://123.domain.123/file.ext http://123.domain.123/Dir/file.ext...
  2. regex7

    Removing unwanted blank charachter from scalar

    Just a hint: $item =~ s/\x160$//g could not work, because after "\x" you need to give a hexadecimal value, not a decimal one. 160 decimal is A0 hexadecimal => $item =~ s/\xA0+$//o should discard the characters in question (and no others).
  3. regex7

    fnd latest file in directory -A syntax

    Hi Graham, if you work under Unix/Linux, another solution could be to invoke the shell, as the -t option of ls sorts the files by date descending. As ls returns the total size in the first line, we just need to filter out the second line. my $latest_file = `ls -t ~/proj/test | head -2 | tail...
  4. regex7

    Parsing dates

    I'd recommend the Parse_Date routine from Date::Calc: #!/usr/bin/perl -w use strict; use Date::Calc qw(Parse_Date); my $date = 'Mon Aug 1 08:07:21 -0700 2005'; my ($year,$month,$day) = Parse_Date($date); print "$year-$month-$day\n"; Holger
  5. regex7

    Copy stuff in increments of 10

    I've never installed/used it, but maybe WebFS::FileCopy might help you? see http://www.cpan.org/modules/by-module/LWP/BZAJAC/WebFS-FileCopy-1.04.readme For the pinging, maybe forking could be of some help. Holger
  6. regex7

    Trim whitespaces > beginning and end

    Looks as if Kevin is totally right: #!/usr/bin/perl -w use strict; my @strings = (" foo ", " bar ", " foo bar "); for (1..100000) { foreach my $string (@strings) { $string =~ s/^\s+//; $string =~ s/\s+$//; } } results in real 0m1.021s user 0m1.000s sys...
  7. regex7

    Trim whitespaces > beginning and end

    s/^\s*(.*?)\s*$/$1/; also empties strings only containing white space (just in case this makes any difference). Holger
  8. regex7

    Matching only certains characters

    It also allows underscore (_) as this is included in \w.
  9. regex7

    Matching

    Hi extension, I suppose you're looking for something like this? #!/usr/bin/perl -w use strict; my @patterns = (); my %seen = (); # We create a list of all patterns we wish to find foreach my $expression ("livvy lump-beach", "orangesty") { foreach my $part (split(/\s+/, $expression)) {...
  10. regex7

    Module to compare dates and times

    There's Date::Calc, too. Holger
  11. regex7

    Datetime vs Epoche in MySQL

    Hi Keith, I personally prefer date-time entries in the database, so I understand the entries at first glance. For fast conversion UNIX_TIMESTAMP(date) can be used (see http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html) to calculate in epoch seconds, but in fact I often calculate...

Part and Inventory Search

Back
Top