set some fiile data as a variable

P

Peter

I'm trying to get some information from a file
and i can print the right data to shell using

print ($line =~ m/\(-vop crop\=(\d+)/g )

but i want to be able to set this as a variable instead.
I know if i set that line equal to a variable i will just
get a value of 1 for true. How can i capture the information
print would show in a variable instead of true or false.
 
M

Michael Budash

Peter said:
I'm trying to get some information from a file
and i can print the right data to shell using

print ($line =~ m/\(-vop crop\=(\d+)/g)

but i want to be able to set this as a variable

or variables, since you've specified the /g flag
instead.
I know if i set that line equal to a variable i will just
get a value of 1 for true. How can i capture the information
print would show in a variable instead of true or false.

($var) = $line =~ m/\(-vop crop\=(\d+)/g;

or to get 'em all into an array:

@vars = $line =~ m/\(-vop crop\=(\d+)/g;

hth-
 
P

Peter

Thanks for your help that worked perfectly!!

($var) = $line =~ m/\(-vop crop\=(\d+)/g;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,250
Latest member
Charlesreero

Latest Threads

Top