siddheshsawant has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re: @ Regular expression:
by kennethk (Abbot) on May 17, 2010 at 20:36 UTC
    Have you read How do I post a question effectively? and Writeup Formatting Tips, as have already been suggested to you in your previous posts like @ ergular expression and @ Regular Expression? Why are you still appending meaningless '@' to the start of your subject lines? Why are you not wrapping your input in <code> tags? You have already had at least one suggested solution fail because of this (Re: @ ergular expression). We are giving you free, valuable advice. Do you think our time is without value? Read and meditate on http://www.catb.org/~esr/faqs/smart-questions.html. Seriously.

    Both your questions are very nearly answered in perlretut. I have given you this link before. Read it. We can help you debug if you post a well-formatted script with input and expected output. What do you mean by "the whole string"? The whole string is already in $row - so store that. And what have you tried for question 2?

Re: @ Regular expression:
by JavaFan (Canon) on May 17, 2010 at 20:35 UTC
    But when I tried to print $machine_class then I got"9000" and "ia64" respectively for the above two examples.
    Of course. Neither a space, nor a slash are word characters, so they aren't matched by \w
    How to get the whole string?
    /.*/. Add a /s modifier is the string can contain a newline.
    I wanted to fetch whatever string appearing in the place of **** which keeps on changing for different instances. How to achieve that using REGEX?
    /64 bit kernel 64 bit user (.*) AIX/s
Re: @ Regular expression:
by marto (Cardinal) on May 17, 2010 at 21:53 UTC
Re: @ Regular expression:
by toolic (Bishop) on May 17, 2010 at 20:36 UTC
    For Q. 1), you could just grab the remainder of the string:
    use strict; use warnings; for my $row ( 'MACHINE_CLASS=9000/800/L3000-5x', 'MACHINE_CLASS=ia64 hp server rx2600' ) { my ($machine_class) = $row =~ (/MACHINE_CLASS=\s*(.*)/); print "$machine_class\n"; } __END__ 9000/800/L3000-5x ia64 hp server rx2600
    Take a look at perlre to see what \w matches.
Re: @ Regular expression:
by jwkrahn (Abbot) on May 17, 2010 at 21:43 UTC

    Q . 1)

    ( my $machine_class = $row ) =~ s/MACHINE_CLASS=\s*//;
Re: @ Regular expression:
by jomonantony (Novice) on May 18, 2010 at 03:25 UTC

    try the code

    $machine_class=~ s/MACHINE_CLASS=//