User Profile

Collapse

Profile Sidebar

Collapse
zcabeli
zcabeli
Last Activity: Mar 14 '11, 04:18 PM
Joined: Jan 28 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • zcabeli
    started a topic replace an expression inside multiline string
    in Perl

    replace an expression inside multiline string

    Hi, i'd like to be able to search and replace a substring within a multiline string.

    for example, if i've got the following text.

    [CODE]
    struct xyz {
    unsigned x;
    unsigned y;
    unsigned z;
    }

    struct abc {
    unsigned x;
    unsigned y;
    unsigned z;
    }
    [\CODE]

    i'd like to replace only the 'x' variable within...
    See more | Go to post

  • zcabeli
    replied to using eval statement inside regexp :
    in Perl
    Hi Miller,

    many thanks for your comprehensive response, it's definitely more readable than what i did :-)
    See more | Go to post

    Leave a comment:


  • zcabeli
    started a topic using eval statement inside regexp :
    in Perl

    using eval statement inside regexp :

    Hi, i'm looking for a way to use eval expression in perl regexp. for example. if i want to match the following pattern X_(X+1)_(X+2) using a single code line, where X represent a numeric value. i.e. 1_2_3 but not 1_2_2

    i'd like to know if the following pseudo code can be written in perl:

    Code:
    ([0-9]+)_eval(\1+1)_eval(\1+2)
    so far what i do is grouping the first numeral, and use it to create...
    See more | Go to post

  • zcabeli
    started a topic excel spreadshit parser :
    in Perl

    excel spreadshit parser :

    Hi, i'm looking for a way to parse xls files in perl for unix.
    perhaps you can advise me, based on experience, which module is most suitable for this task.

    thanks
    See more | Go to post

  • zcabeli
    started a topic remapping elements in array :

    remapping elements in array :

    Hi, i need to sort an array of elements according to certain mapping i get as input.
    for example if my array is : A B C D E
    and the mapping table is : 1 2 5 4 3
    then the result will be : A B E D C

    atomic operation : swap(a,b) - also uses 1 memory space a temporal storing place.

    i need a method the perform the above function in minimal memory consumption, minimal number of atomic operations,...
    See more | Go to post

  • zcabeli
    started a topic temp string manipulation :
    in Perl

    temp string manipulation :

    HI,

    i'd like to use regexp replacement without changing variable value.
    for example : in the following code i'd like to preseve the value of $key, but i need to change it's value in order to use it as an hash key. however, the hash key is only temporal and can be destroyed right after getting the hash.

    Code:
     
    my $key   = "aaa.bbb.ccc"; 
    my $temp =~ s/\.ccc//; 
    print $hash{$temp};
    ...
    See more | Go to post

  • zcabeli
    replied to how 2 edit file like list of lines :
    in Perl
    thanks for the help !
    the tie package really suits my requirements.
    btw, sorry for not following the guidelines this time, i'll make sure it won't happen again.
    See more | Go to post

    Leave a comment:


  • zcabeli
    started a topic how 2 edit file like list of lines :
    in Perl

    how 2 edit file like list of lines :

    Hi, i'd like to have an easy way of doing IO operation in files :
    my main 2 tasks are :
    1. reading line from file. for this i've created the following function :
    Code:
       sub read_line { 
          my $filename = shift; 
          my $index    = shift; 
          open FILE, $filename or die "can't open $filename";
          my @text = <FILE>;
          return $text[$index];
       }
    2....
    See more | Go to post
    Last edited by numberwhun; Sep 27 '09, 12:49 PM. Reason: Please use code tags!

  • thanks again, i found all i need (and much more) in perlre
    See more | Go to post

    Leave a comment:


  • hey, thanks for the help ! i really appreciate it.
    can you explain what does the '\u' symbol means, i haven't found it in any perl documentation
    See more | Go to post

    Leave a comment:


  • how to replace each first letter of a word into capital letter :

    Hi all, i'm currently struggling to perform the above mentioned replacement.

    i already know how to catch the first letter in each word and determined if it's regular or capital.

    however, i don't know how to replace this letter with it's corresponding capital letter.

    perhaps there is an option to change the ascii value of the a character in perl regexp ?

    for example :

    ...
    See more | Go to post

  • zcabeli
    replied to making perl script an executable program.
    in Perl
    i'll definetly give it a shot, i'll let you know if i found someting useful,

    thanks
    See more | Go to post

    Leave a comment:


  • zcabeli
    started a topic making perl script an executable program.
    in Perl

    making perl script an executable program.

    Hello,

    i've installed some modules in my unix machine which i'm using in my scripts. however, i'd like to make those scripts executable from any machine, with minimal requirements of perl installed. is it possible ?

    thanks,
    See more | Go to post

  • zcabeli
    replied to looking for perl synonym to #define in C/C++
    in Perl
    thanks for the help.
    See more | Go to post

    Leave a comment:


  • zcabeli
    replied to looking for perl synonym to #define in C/C++
    in Perl
    Hi,

    #define used as macro in C. it's simply replace the first argument with the string represented by the second argument. format type is as follows :

    definition :
    #define ABC(X,Y,Z) BLA(X) + BLA(Y) + BLA(Z)
    #define FIVE 5

    usage :
    ABC(5,2,1) = BLA(5) + BLA(2) + BLA(1)
    x = 1 + FIVE
    See more | Go to post

    Leave a comment:


  • zcabeli
    started a topic looking for perl synonym to #define in C/C++
    in Perl

    looking for perl synonym to #define in C/C++

    Hello,
    i'm looking for the equivalent perl symbol that match #define in C/C++
    anybody have an idea if any such feature exists ...

    thanks,
    See more | Go to post

  • zcabeli
    replied to uninitialized string :
    in Perl
    Hi,

    i accidently placed the extra $. removing it solved the problem.

    thanks,
    See more | Go to post

    Leave a comment:


  • zcabeli
    replied to find index of an element in a list
    in Perl
    Hello Kevin,

    i'm sorry i've made a wrong impression on you. but in fact your replies were very helpful, and i didn't see any point to response since it supplied all my needs.
    although it's not part of any formal site regulation, i guess it was impolite behavior, and i'm sorry for that. please accept my apology.

    thanks ,
    See more | Go to post

    Leave a comment:


  • zcabeli
    started a topic uninitialized string :
    in Perl

    uninitialized string :

    Hi

    Code:
    my $x = "1-6"; 
    if ($x =~ /^\s*([0-9]+)\-([0-9]+)$\s*$/) {
       print "SUCCEED \n"; 
    } else { 
       print "FAILED \n"; 
    }
    i've got this simple regexp code. when i run it with use strict i get the following warning msg: "Use of uninitialized value in concatenation (.) or string .." at the line of the regexp match pattern. can anybody...
    See more | Go to post

  • zcabeli
    started a topic find index of an element in a list
    in Perl

    find index of an element in a list

    Hello,

    how can i find the index of an existing element in a list ?



    thanks,
    See more | Go to post
No activity results to display
Show More
Working...