23skiddoo has asked for the wisdom of the Perl Monks concerning the following question:
Hello, Monks. It's been a while. I've flirted with Python , Go, and Ruby but still end up using Perl since it's most comfortable.
Anyway, on with the question: If I could think of the nomenclature I'd use it, but what I want to do is pre-define a string that contains a variable that will be assigned only later, and still adhere to the strict and warnings pragmas. Here is some pseudo-code:
my $url = "http://something.com/api_stuff/$GUID"; # do stuff make_call( '1234' ); sub make_call { my $GUID = shift; POST->$url; }
Is anything like this even doable? I could set $GUID as a global variable but I don't want other subs that might use $url in different context to get hosed up. I may end up having to use regexes or other methods.
Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Strings with undefined variables?
by choroba (Cardinal) on Jan 03, 2019 at 23:26 UTC | |
by 23skiddoo (Beadle) on Jan 04, 2019 at 13:00 UTC | |
|
Re: Strings with undefined variables?
by tobyink (Canon) on Jan 03, 2019 at 23:32 UTC | |
|
Re: Strings with undefined variables?
by bliako (Abbot) on Jan 04, 2019 at 10:56 UTC | |
by 23skiddoo (Beadle) on Jan 04, 2019 at 12:58 UTC | |
by bliako (Abbot) on Jan 04, 2019 at 14:09 UTC | |
by jimpudar (Pilgrim) on Jan 05, 2019 at 22:35 UTC | |
by bliako (Abbot) on Jan 06, 2019 at 11:04 UTC | |
|
Re: Strings with undefined variables?
by jimpudar (Pilgrim) on Jan 05, 2019 at 01:58 UTC |