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 SkipVought 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. user2base

    Pushing data into an array in fork

    Does someone know how to push data into an array as part of a fork process ?? I always get an empty array. My code looks like this (I am using Parallel::ForkManager): my $pid; my $pm = new Parallel:ForkManager(5); foreach my $element (@list){ $pid = $pm->start and next; ... $result = .... ...
  2. user2base

    pattern substitution question

    Hello, I've got an input text in which I want to replace every string like "match(value)" by "value" (and store all "value" in an array) i.e: bla bla bla bla bla match(value1) bla bla bla match(value2) bla bla bla match bla bla bla match(value3) bla becomes: bla...
  3. user2base

    naming arrays dynamically

    I am using Parallel::ForkManager to fork a subroutine used in a perl script. This subroutine uses an array (called @array). My script get confused because (I reckon) of the name of the array is shared by all forked children. So that, the content of @array might not be the one I expect to be...
  4. user2base

    DBI syntax

    Thanks. It works.
  5. user2base

    DBI syntax

    I want to delete entries in a mysql table for which timestamp is older than 1 Hour. The mysql syntax is: DELETE from table WHERE t < DATE_SUB(NOW(), INTERVAL 1 HOUR); This works fine but I can't get it running through a perl DBI command. The following for instance does not work...
  6. user2base

    Restricting Size of log files

    I've got a script that opens a log file and write into it. I would like this file not to exceed a certain limit (500 lines for instances) i.e if I had line #501 line it's going to remove line #1 and so on... Is there a nice way to achieve that ?
  7. user2base

    Problem reading a file

    Thanks !!
  8. user2base

    Problem reading a file

    I've quoted below a basic script that reads a file and prints its content. Whatever the file is (/etc/hosts is just an example), the script adds a space for all the lines following line #1, i.e: line 1 line 2 line 3 I would like it to return the file as it is, i.e: line 1 line 2 line 3...
  9. user2base

    Script fot automation of module installation

    I've got a few perl scripts that use specific modules. I want to run them on many different systems that are not connected to the internet and I would like to save time and to make the installation of these modules easy for other users. My idea is to create an installation script that will...
  10. user2base

    Fork issue solved + bonus question

    Hello, Not sure if the category &quot;helpful Tip&quot; is rightly choosen. Anyway, that might benefits to &quot;less advanced&quot; programmers like me. A few days ago I posted a question related to a fork issue on perl 5.8. I have just found the problem. The script I quoted was using fork...
  11. user2base

    Fork in Perl 5.8

    Actually I have slightly modified this script like this: - using Net::Ping (this should not make any difference) - by pushing the result in an array within the last loop like this: ------------------------------------------ 1 while wait_for_a_kid(); for (sort keys %host_result) {...
  12. user2base

    Fork in Perl 5.8

    I've found a script on the web that uses fork to run several pings in parallel. It works fine on a Linux box running perl 5.00x but it does not work on RedHat 8 with perl 5.8. Is it due to the new multi threading architecture in 5.8 ? Moreover, I've read on this forum that you can not push...
  13. user2base

    Best way to organize a project ?

    I am writing a project involving 10 to 20 perl scripts calling subroutines that I have organised in modules (.pm files). I have also one .pm file that contains all my global variables. I am not using packages because I don't feel the need for different namespaces here. Is it the best and more...
  14. user2base

    Best Match between keys in a hash

    No idea anyone ?
  15. user2base

    Best Match between keys in a hash

    In this case my regex would be sthg like: $regex = &quot;aaa bbb ddd|aaa ccc|aaa bbb eee|aaa bbb eee fff&quot;; And I would like a line starting with &quot;aaa ccc ...&quot; to match the 2nd key not the the first one just because it starts with &quot;aaa&quot; because the action will differ...
  16. user2base

    Best Match between keys in a hash

    I want to match all the lines of a file against keys in a hash so that there is a match if the line begins with a key. In order to do that I have created a regex that is a join off all the keys separated by &quot;|&quot; my $regex = join('|', keys %hash); then I use the following pattern...
  17. user2base

    Multi Thread ??

    I am writing a simple program using the Net::Ping module to ping devices on a network. However, using a timeout of 1s per ping it's going to take 255 seconds to ping a class C. Is there any way to split the IP range and run multiple pings in parrallel within my perl script ?? Thanks for your...
  18. user2base

    Finding directories or files

    ok. So far I am using: find sub { print &quot;$File::Find::name\n&quot; if -e &quot;$txt&quot;}, &quot;$src&quot;; but the output is not what I expect as it returns all the directories that are contained in the same parent directory that the one I search for...
  19. user2base

    Finding directories or files

    How to implement a script that returns all the files and directories (including the path) which name contains &quot;$txt&quot; from &quot;$srcdir&quot; ?? I am close to it using the File::Find module but not quite... Thanks for your help.
  20. user2base

    Question about file formating

    I have a file that looks like this: blabla ! ! ! bla bla ! bla blablabla ! ! etc... How to remove all the ! in a series but one so that the result looks like: blabla ! bla bla ! bla blablabla !

Part and Inventory Search

Back
Top