arunnich 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: Getting string value after = operator
by castaway (Parson) on Feb 12, 2003 at 11:59 UTC
    Hi arunnich,
    A lot of people know how to do that here. But you probably wont get any solutions. It's because we're here to try and help other people learn Perl, and not to give out complete solutions. If you try and write a script, and show us what you have tried, and where it went wrong, then you're much more likely to get help here.

    Try reading the Perl Monks guide to the Monastery to see what we're all about.

    C.

Re: Getting string value after = operator
by Bilbo (Pilgrim) on Feb 12, 2003 at 11:56 UTC

    I'm not quite sure what you're asking. Example input and output and your script as it is at the moment are generally helpful to clarify the question.

    I assume from your title and first part of your question that given a string you want to get any text after an equals sign, and that then you know how to put it in a file, or whatever you want to do with it. If so then this might help:

    #!/usr/bin/perl -w use strict; my $string = "name = arrunich"; if ($string =~ m/= \s* (\S+)/x) { print "$1 \n"; }

    This uses a regular expression which looks for an = sign followed by zero or more spaces, followed by one or more non-spaces. If it finds it then it puts the non-spaces in $1.

    You might find String matching and Regular Expressions useful.

    Update: First paragraphs added

Re: Getting string value after = operator
by zakzebrowski (Curate) on Feb 12, 2003 at 11:54 UTC
    what are you talking about? If youre compiling code, look at the b or deparse modules, if you are writing a web page, look at cgi... Or, if it's in a file just open the file, read it in, and then do a split on = ...

    ----
    Zak
    Pluralitas non est ponenda sine neccesitate - mysql's philosphy