It’s counter-intuitive, but historians would actually stress the lack of surprise. The popular narrative is that Japan was closed to the outside world until Perry forced the country wide open, and the outside world poured in immediately. This really isn’t the case. A lot more knowledge and materials flowed into Edo Period Japan than people usually imagine. Furthermore, the process of fully opening the country to foreigners took place over a period of fourteen years following the Convention of Kanagawa in 1854. What you knew about the outside world and modern science before Perry’s arrival, what you learned after, and what shocked you would depend completely on your status and geographical location.
Quoting myself from an earlier post:
Westerners today largely know about the small Dutch trading post of Dejima at Nagasaki, but Chinese traders were also welcome and very numerous in the port of Nagasaki, where they had a large quarter of the city. Korean trade took place at the island of Tsuushima which is halfway between Japan and Korea on the shortest route between the two countries. In the north, the Matsumae clan handled trade with the Ainu on the frontier of Japanese control. And, last but not least, the Ryukyu Kingdom (today's Okinawa) was officially an independent vassal state to both Japan and China. In practice, the Ryukyu Kingdom was under the domination of Japan's Satsuma domain, and Satsuma traded with China through the polite fiction of the Ryukyu Kingdom doing the trading.
Through the Dutch and Chinese contacts, in particular, lots of scientific and political information entered Japan. As an example, Japanese scholars by the time of Perry were very aware of the science of electricity, carrying out their own experiments. The effect of Japan being “closed”, though, was that there was certainly a delay in new technology and science entering the country. Japanese 19th century scholars were completely aware of that delay, and that Western technology, science, military strategies, and geographic knowledge had pulled far ahead of Japanese knowledge, and were impatient to learn more, and afraid of Western power.
MIT’s Visualizing Cultures website has a great illustrated essay: The Opium War in Japanese Eyes on an 1849 Japanese book on the Western powers’ treatment of China, which includes sketches of steamships. The book, with its fearful concern for Japan’s strength, was censored by the shogunate, but widely circulated nonetheless among scholars. Other less-censored books on the history and geography of the world were also published in the first half of the nineteenth century. Weirdly enough, George Washington actually became a Japanese scholarly cultural hero before Perry arrived in Japan.
The ordinary populace knew much less, of course. Their introduction to Western ways and technology would be a series of surprises, but gradually, over a long period. The treaty of Kanagawa, only opened trading at two ports: Shimoda and Hakodate, and it wasn’t until 1868 that the new Meiji government committed to completely opening Japan to foreigners. During the interval, the foreign foothold in Japan gradually increased. There was no one moment where every new thing came flooding in.
Knowing there was a gap in technology was one thing. Seeing was really believing. Actually seeing the Black Ships steam into Edo Bay shook people who already knew of their existence, as well as the ordinary people who had only the vaguest idea. The most shocked and surprised Japanese observers soon after the Convention of Kanagawa were the lucky few who were sent abroad and could take in the scale of Western advances in technology.
The 1860 mission to the United States was the first Japanese mission overseas in centuries, and its members were completely blown away by what they saw (though not always culturally or morally approving.) There’s a very good, readable book about their experience: “As We Saw Them: The First Japanese Embassy to the United States” by Masao Miyoshi. Fukuzawa Yukichi, one of the mission members, recalled many years later:
Then we were taken to a hotel. All the floors were covered by carpets—the kind of fabric the richest Japanese splurged on, spending a fortune for square inches so a wallet or pouch could be made. The fabric was spread all over the floor in these huge rooms. And people stepped on them in their street shoes. They didn't change their shoes, so we didn't take off our zori either. At once we were served drinks. When a bottle was opened, it exploded with a frightening noise. The strange drink was champagne. There was something floating in our glasses. Of course we didn't know they could have ice in such warm spring weather. Those glasses standing in a row before us, and we trying to drink it up! Some were frightened by the floating objects and spat them out; some were loudly crunching on the cubes. It took us some time before we all realized it was ice. We wanted to smoke. There were no tobacco trays [tabako bon], nor ash trays [hai fuki]. I lit my pipe from the fire in the stove. I suppose there were matches on the table, but we didn't know what they were. Well, I lit my pipe, but finding no tray to put the ashes in, I pulled out tissue paper from my breast pocket, emptied the ashes into it, and crushing the fire out care-fully and twisting the paper into a ball, I put it back into my pocket. I was trying to have another puff, when smoke began to rise from my kimono sleeve. My God! the fire wasn't out, and it was spreading to the pocket!" (p. 33, As We Saw Them)
If this tale interests/amuses you, there is plenty more of these stories in this book, and similar tales of encountering the unknown in other books about the first Japanese visitors to Europe and America.