Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Escaping characters in the array

by penguinfuz (Pilgrim)
on May 31, 2002 at 13:55 UTC ( [id://170710]=note: print w/replies, xml ) Need Help??


in reply to Escaping characters in the array

particle wrote: see quotemeta

Cheer Particle. quotemeta is a great tool to add to my growing arsenal. ;)
After quoting the meta characters, I found my logic was all wrong so I started rewriting.

tadman wrote:
  • The real problem seems to be the way you are using your arrays. You're not indexing correctly....
  • Better still to just iterate and forget the index unless you actually need it...
  • As an explanation, the \Q starts "escaping" special characters, the \E stops...

  • Very thought provoking stuff, especially the bit about indexing correctly. I am still not positive about what would exactly be the correct way to index with this issue, but I took your advice and did away with it, actually, the code is quite different now, but it _is_ doing what I want. ;)

    Here's a snippet
    my @new = `cat /path/to/some/file`; foreach my $new (@new) { my $args = `rpm -qa | grep $new`; print $new if ($args =~ m/^$/); }
    The actual application for this code has changed focus since my first posting, This time the definition is truelly what I want to do, where as the last description was simply a secondary function.

    I take a listing of "new" RPMs and compare them against the installed RPMs. If there is no match, I will assume (at the moment) the package should be downloaded and installed.

    What I am working towards now is:
    • Sanity checking in relation to packages versions. Older version "new" packages should not be installed
    • Using a hash for the values in @new. This is because when I query an RPM package, I cannot query with the extension in tack, otherwise nothing will match. For example:
      • Search for: glibc-2.2.5-34
      • Download: glibc-2.2.5-34.i386.rpm

    Ok, enough talking back to writing. ;)
    BTW: ++ all around guys for the great ideas!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://170710]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (1)
As of 2024-04-25 02:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found