Thanks! Yeah, I expected I could do something like the following. Note that the actual use case involves several URLs that would like to store in a hash. (Also, I've been using Perl for almost 20 years, mostly in text processing. Only dabbled in Python and don't care for it much.)
my %URLS = ( upload => 'https://somewhere.com/api1', process => 'https://somewhere.com/=GUID=/api2', ); my $guid = upload_file( $ARGV[0] ); my $rtn = process_file( $guid ); sub upload_file { my $fn = shift; # LWP::UserAgent stuff my $g = $ua->post( $URLS{ upload } . '?' . $fn ); return $g; } sub process_file { my $guid = shift; # LWP::UserAgent stuff ( my $this_url = $URLS{ process } ) =~ s/=GUID=/$guid/; my $result = $ua->post( $this_url ); return $result || 0; }
In reply to Re^2: Strings with undefined variables?
by 23skiddoo
in thread Strings with undefined variables?
by 23skiddoo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |