in reply to Re: Replacing a block of text inside two keys with another block of text
in thread Replacing a block of text inside two keys with another block of text

I'm not sure how to modify the file since I am unable to load the file in and access the hash. If there is another solution I will be more than happy to implement it.

#what replacement data looks like "new/path/desired/data" "new/path/desired/data" "new/path/desired/data"
#data looks kinda like this key1 => { #some data i don't need #more data i don't need <<'END_SEARCHPATHS', #block of data I want to replace "some/path/to/some/file" "some/path/to/some/file" "some/path/to/some/file" "some/path/to/some/file" "some/path/to/some/file" "some/path/to/some/file" END_SEARCH_PATHS } key2 => { <<'END_SEARCHPATHS', #another block of data to replace "another/path/to/some/file" "another/path/to/some/file" "another/path/to/some/file" "another/path/to/some/file" END_SEARCH_PATHS }

Replies are listed 'Best First'.
Re^3: Replacing a block of text inside two keys with another block of text
by LanX (Saint) on Apr 24, 2017 at 22:41 UTC
    Filtering a dumped hash like this will not work reliably.

    Read the file in with do and filter the desired hash keys with a grep

    if this is not possible because of size or because order matters (i.e. wrong data format) consider using another data format!

    Probably best a SQL DB

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

Re^3: Replacing a block of text inside two keys with another block of text
by Anonymous Monk on Apr 25, 2017 at 02:02 UTC
    Your "sample data" sometimes omits the underscore in SEARCH_PATHS. If your real data does that, maybe that's one of your problems? If it doesn't, please stop giving us sample data that isn't representative.