> What you have done is almost what I want,  thank you for that,
> but it is evident that I have not explained it very well.
>
> What I want perl to do, is to read the string in from the file
> and put it in $variable .
> This $variable string is changing from file to file.
> a few examples of strings in different files:
>
> boundary="----=_NextPart_001_004B_01C08570.D30AB6E0"
> boundary="----=_NextPart_001_0078_01C08533.7A1819C0"
> boundary="----=_NextPart_000_01C08542.17EE41C0"
> boundary="==i3.9.0oisdboibsd((kncd"
>
> $variable is starting with a ( " ) and ending with ( " )
> If you can help me with that
> then I think I am very close to what I want.
>


Ah!  What you need here is a little Perl magic.  ;-)

This line...
$variable = $1 if $string =~ /boundary=\"(.*)\"/;

...will set $variable with what comes between the "'s on lines containing
'boundary="*"'.

Perl does this by setting $1 with what's contained within ()'s, as long as the
whole regular expression matches.  If you had more ()'s within your regular
expression, the subsequent matched strings would be placed in $2, $3, etc.


> I will also have to take the file names from the command line.
> A suggestion for that is much appriciated.
>
> Best regards
> Mettavihari


Am I assuming correctly that you want to specify file names as arguments to
your perl script?

Command line arguments are contained in the list variable @ARGV.  You can
access individual elements of a list by index.  For example, $ARGV[0],
$ARGV[1], etc.


I'm glad to help.  Perl is what I do.  Although, as some of you readers are
thinking to yourself right now, this isn't exactly the forum for this.  :-D

Now if someone here could answer some of the questions I've submitted.  :-P

Best regards,
Clarence Donath
mrdo.com



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to